<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_codegen_llvm/src/llvm, branch perf-tmp</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=perf-tmp</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=perf-tmp'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-10-02T06:55:51+00:00</updated>
<entry>
<title>codegen: Generate `dbg_value` for the ref statement</title>
<updated>2025-10-02T06:55:51+00:00</updated>
<author>
<name>dianqk</name>
<email>dianqk@dianqk.net</email>
</author>
<published>2025-06-18T14:04:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1bd89bd42e0bb6f29b8af5d6bdf3f756196bb8ee'/>
<id>urn:sha1:1bd89bd42e0bb6f29b8af5d6bdf3f756196bb8ee</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Auto merge of #147198 - matthiaskrgr:rollup-b0ryvvu, r=matthiaskrgr</title>
<updated>2025-10-01T04:46:14+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2025-10-01T04:46:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1e1a39441bd11aba541a48ba714d939490fc7b85'/>
<id>urn:sha1:1e1a39441bd11aba541a48ba714d939490fc7b85</id>
<content type='text'>
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#143069 (Add fast-path for accessing the current thread id)
 - rust-lang/rust#146518 (Improve the documentation around `ZERO_AR_DATE`)
 - rust-lang/rust#146596 (Add a dummy codegen backend)
 - rust-lang/rust#146617 (Don’t suggest foreign `doc(hidden)` types in "the following other types implement trait" diagnostics)
 - rust-lang/rust#146635 (cg_llvm: Stop using `as_c_char_ptr` for coverage-related bindings)
 - rust-lang/rust#147184 (Fix the bevy implied bounds hack for the next solver)

r? `@ghost`
`@rustbot` modify labels: rollup
</content>
</entry>
<entry>
<title>Rollup merge of #146635 - Zalathar:llvm-cov, r=SparrowLii</title>
<updated>2025-09-30T19:53:35+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-09-30T19:53:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b21c438eb506d803354af91ca1fc34e47713d799'/>
<id>urn:sha1:b21c438eb506d803354af91ca1fc34e47713d799</id>
<content type='text'>
cg_llvm: Stop using `as_c_char_ptr` for coverage-related bindings

[As explained by a note in `ffi.rs`](https://github.com/rust-lang/rust/blob/8a1b39995e5b630c5872f5de5079f1f569bd5ac2/compiler/rustc_codegen_llvm/src/llvm/ffi.rs#L4-L11), passing strings and byte slices through FFI is more convenient if we take advantage of the fact that `*const c_uchar` and `*const c_char` have the same ABI.

Doing so avoids having to rely on a special helper function, since we can just call `as_ptr` instead.

(The same logic applies to every other binding that currently uses the `as_c_char_ptr` helper; I just haven't adjusted all of them yet.)

---

As a drive-by change, this PR also marks some coverage-related FFI bindings as `safe`.
</content>
</entry>
<entry>
<title>Replace `MetadataType` with the `MetadataKindId` constants</title>
<updated>2025-09-30T10:10:30+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-30T10:05:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cc6329a9bcd78c4531e9713775e2936fe223e601'/>
<id>urn:sha1:cc6329a9bcd78c4531e9713775e2936fe223e601</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Declare all "fixed" metadata kinds as `MetadataKindId`</title>
<updated>2025-09-30T10:10:10+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-29T10:21:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=906bf49ade52d7485a6c8a0756f020ade3a342b6'/>
<id>urn:sha1:906bf49ade52d7485a6c8a0756f020ade3a342b6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move `MetadataKindId` into its own submodule</title>
<updated>2025-09-30T10:07:54+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-29T10:53:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cd40bbfe2965a42ae8336ebd70fc7fb9c81d22e0'/>
<id>urn:sha1:cd40bbfe2965a42ae8336ebd70fc7fb9c81d22e0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #144197 - KMJ-007:type-tree, r=ZuseZ4</title>
<updated>2025-09-28T16:13:11+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-09-28T16:13:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c29fb2e57ed0578c9051cc9314b0225f847de710'/>
<id>urn:sha1:c29fb2e57ed0578c9051cc9314b0225f847de710</id>
<content type='text'>
TypeTree support in autodiff

# TypeTrees for Autodiff

## What are TypeTrees?
Memory layout descriptors for Enzyme. Tell Enzyme exactly how types are structured in memory so it can compute derivatives efficiently.

## Structure
```rust
TypeTree(Vec&lt;Type&gt;)

Type {
    offset: isize,  // byte offset (-1 = everywhere)
    size: usize,    // size in bytes
    kind: Kind,     // Float, Integer, Pointer, etc.
    child: TypeTree // nested structure
}
```

## Example: `fn compute(x: &amp;f32, data: &amp;[f32]) -&gt; f32`

**Input 0: `x: &amp;f32`**
```rust
TypeTree(vec![Type {
    offset: -1, size: 8, kind: Pointer,
    child: TypeTree(vec![Type {
        offset: -1, size: 4, kind: Float,
        child: TypeTree::new()
    }])
}])
```

**Input 1: `data: &amp;[f32]`**
```rust
TypeTree(vec![Type {
    offset: -1, size: 8, kind: Pointer,
    child: TypeTree(vec![Type {
        offset: -1, size: 4, kind: Float,  // -1 = all elements
        child: TypeTree::new()
    }])
}])
```

**Output: `f32`**
```rust
TypeTree(vec![Type {
    offset: -1, size: 4, kind: Float,
    child: TypeTree::new()
}])
```

## Why Needed?
- Enzyme can't deduce complex type layouts from LLVM IR
- Prevents slow memory pattern analysis
- Enables correct derivative computation for nested structures
- Tells Enzyme which bytes are differentiable vs metadata

## What Enzyme Does With This Information:

Without TypeTrees (current state):
```llvm
; Enzyme sees generic LLVM IR:
define float ``@distance(ptr*`` %p1, ptr* %p2) {
; Has to guess what these pointers point to
; Slow analysis of all memory operations
; May miss optimization opportunities
}
```

With TypeTrees (our implementation):
```llvm
define "enzyme_type"="{[]:Float@float}" float ``@distance(``
    ptr "enzyme_type"="{[]:Pointer}" %p1,
    ptr "enzyme_type"="{[]:Pointer}" %p2
) {
; Enzyme knows exact type layout
; Can generate efficient derivative code directly
}
```

# TypeTrees - Offset and -1 Explained

## Type Structure

```rust
Type {
    offset: isize, // WHERE this type starts
    size: usize,   // HOW BIG this type is
    kind: Kind,    // WHAT KIND of data (Float, Int, Pointer)
    child: TypeTree // WHAT'S INSIDE (for pointers/containers)
}
```

## Offset Values

### Regular Offset (0, 4, 8, etc.)
**Specific byte position within a structure**

```rust
struct Point {
    x: f32, // offset 0, size 4
    y: f32, // offset 4, size 4
    id: i32, // offset 8, size 4
}
```

TypeTree for `&amp;Point` (internal representation):
```rust
TypeTree(vec![
    Type { offset: 0, size: 4, kind: Float },   // x at byte 0
    Type { offset: 4, size: 4, kind: Float },   // y at byte 4
    Type { offset: 8, size: 4, kind: Integer }  // id at byte 8
])
```

Generates LLVM:
```llvm
"enzyme_type"="{[]:Float@float}"
```

### Offset -1 (Special: "Everywhere")
**Means "this pattern repeats for ALL elements"**

#### Example 1: Array `[f32; 100]`
```rust
TypeTree(vec![Type {
    offset: -1, // ALL positions
    size: 4,    // each f32 is 4 bytes
    kind: Float, // every element is float
}])
```

Instead of listing 100 separate Types with offsets `0,4,8,12...396`

#### Example 2: Slice `&amp;[i32]`
```rust
// Pointer to slice data
TypeTree(vec![Type {
    offset: -1, size: 8, kind: Pointer,
    child: TypeTree(vec![Type {
        offset: -1, // ALL slice elements
        size: 4,    // each i32 is 4 bytes
        kind: Integer
    }])
}])
```

#### Example 3: Mixed Structure
```rust
struct Container {
    header: i64,        // offset 0
    data: [f32; 1000],  // offset 8, but elements use -1
}
```

```rust
TypeTree(vec![
    Type { offset: 0, size: 8, kind: Integer }, // header
    Type { offset: 8, size: 4000, kind: Pointer,
        child: TypeTree(vec![Type {
            offset: -1, size: 4, kind: Float // ALL array elements
        }])
    }
])
```
</content>
</entry>
<entry>
<title>Rollup merge of #146763 - Zalathar:di-builder, r=jdonszelmann</title>
<updated>2025-09-28T07:15:23+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-09-28T07:15:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e8578c88085b0554c1b3b6252f1d870015f39d25'/>
<id>urn:sha1:e8578c88085b0554c1b3b6252f1d870015f39d25</id>
<content type='text'>
cg_llvm: Replace some DIBuilder wrappers with LLVM-C API bindings (part 5)

- Part of rust-lang/rust#134001
- Follow-up to rust-lang/rust#146673

---

This is another batch of LLVMDIBuilder binding migrations, replacing some our own LLVMRust bindings with bindings to upstream LLVM-C APIs.

Some of these are a little more complex than most of the previous migrations, because they split one LLVMRust binding into multiple LLVM bindings, but nothing too fancy.

This appears to be the last of the low-hanging fruit. As noted in https://github.com/rust-lang/rust/issues/134001#issuecomment-2524979268, the remaining bindings are difficult or impossible to migrate at present.
</content>
</entry>
<entry>
<title>Use `LLVMDisposeTargetMachine`</title>
<updated>2025-09-25T08:10:55+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-25T08:10:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=85018f09f67bd54868fe12a4632bbd637a474853'/>
<id>urn:sha1:85018f09f67bd54868fe12a4632bbd637a474853</id>
<content type='text'>
</content>
</entry>
<entry>
<title>emit attribute for readonly non-pure inline assembly</title>
<updated>2025-09-21T19:16:06+00:00</updated>
<author>
<name>Folkert de Vries</name>
<email>folkert@folkertdev.nl</email>
</author>
<published>2025-09-19T18:39:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3565b0699d6830dc31732afa96272bcbd1f83606'/>
<id>urn:sha1:3565b0699d6830dc31732afa96272bcbd1f83606</id>
<content type='text'>
</content>
</entry>
</feed>
