<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_codegen_llvm/src/lib.rs, 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-09-29T01:56:44+00:00</updated>
<entry>
<title>Rollup merge of #147127 - antoyo:fix/gcc-linker-plugin, r=bjorn3</title>
<updated>2025-09-29T01:56:44+00:00</updated>
<author>
<name>Stuart Cook</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-29T01:56:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=af8af6cc6a40fe32e791a94196329db25b597ee6'/>
<id>urn:sha1:af8af6cc6a40fe32e791a94196329db25b597ee6</id>
<content type='text'>
Add a leading dash to linker plugin arguments in the gcc codegen

Fix rust-lang/rust#130583

r? ``@bjorn3``
</content>
</entry>
<entry>
<title>Add a leading dash to linker plugin arguments in the gcc codegen</title>
<updated>2025-09-28T17:57:33+00:00</updated>
<author>
<name>Antoni Boucher</name>
<email>bouanto@zoho.com</email>
</author>
<published>2025-09-28T16:08:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=7fcbc5ea465a4e280d3b7a84fc3f781e9a120ed0'/>
<id>urn:sha1:7fcbc5ea465a4e280d3b7a84fc3f781e9a120ed0</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>generate list of all variants with `target_spec_enum`</title>
<updated>2025-09-19T22:14:50+00:00</updated>
<author>
<name>Deadbeef</name>
<email>ent3rm4n@gmail.com</email>
</author>
<published>2025-09-19T22:14:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=4841d8c5ffb6a7bd025c14d8e9d2c23e6c458792'/>
<id>urn:sha1:4841d8c5ffb6a7bd025c14d8e9d2c23e6c458792</id>
<content type='text'>
This helps us avoid the hardcoded lists elsewhere.
</content>
</entry>
<entry>
<title>Add TypeTree metadata attachment for autodiff</title>
<updated>2025-09-19T04:02:19+00:00</updated>
<author>
<name>Karan Janthe</name>
<email>karanjanthe@gmail.com</email>
</author>
<published>2025-08-23T21:56:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=375e14ef491ac7bfa701e269b2815625abf2fca6'/>
<id>urn:sha1:375e14ef491ac7bfa701e269b2815625abf2fca6</id>
<content type='text'>
  - Add F128 support to TypeTree Kind enum
  - Implement TypeTree FFI bindings and conversion functions
  - Add typetree.rs module for metadata attachment to LLVM functions
  - Integrate TypeTree generation with autodiff intrinsic pipeline
  - Support scalar types: f32, f64, integers, f16, f128
  - Attach enzyme_type attributes as LLVM string metadata for Enzyme

Signed-off-by: Karan Janthe &lt;karanjanthe@gmail.com&gt;
</content>
</entry>
<entry>
<title>Remove want_summary argument from prepare_thin</title>
<updated>2025-09-06T18:37:23+00:00</updated>
<author>
<name>bjorn3</name>
<email>17426603+bjorn3@users.noreply.github.com</email>
</author>
<published>2025-09-04T15:16:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f2933b34a8331204270fa2bdbdcfd79fcffbb302'/>
<id>urn:sha1:f2933b34a8331204270fa2bdbdcfd79fcffbb302</id>
<content type='text'>
It is always false nowadays. ThinLTO summary writing is instead done by
llvm_optimize.
</content>
</entry>
<entry>
<title>Directly raise fatal errors inside the codegen backends</title>
<updated>2025-08-24T11:20:41+00:00</updated>
<author>
<name>bjorn3</name>
<email>17426603+bjorn3@users.noreply.github.com</email>
</author>
<published>2025-08-24T10:47:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=525c6a356284ea47587f0316cec23cab290b986e'/>
<id>urn:sha1:525c6a356284ea47587f0316cec23cab290b986e</id>
<content type='text'>
As opposed to passing it around through Result.
</content>
</entry>
<entry>
<title>Rollup merge of #145432 - Zalathar:target-machine, r=wesleywiser</title>
<updated>2025-08-19T04:18:25+00:00</updated>
<author>
<name>Stuart Cook</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-08-19T04:18:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8945924d77065c96d35f81bc19a0b9040664bb57'/>
<id>urn:sha1:8945924d77065c96d35f81bc19a0b9040664bb57</id>
<content type='text'>
cg_llvm: Small cleanups to `owned_target_machine`

This PR contains a few tiny cleanups to the `owned_target_machine` code.

Each individual commit should be fairly straightforward.
</content>
</entry>
<entry>
<title>Declare module `rustc_codegen_llvm::back` in the normal way</title>
<updated>2025-08-15T10:24:13+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-08-15T10:06:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8d0a04966c97eb2015c950396e54f31f5212a888'/>
<id>urn:sha1:8d0a04966c97eb2015c950396e54f31f5212a888</id>
<content type='text'>
Declaring these submodules directly in `lib.rs` was needlessly confusing.
</content>
</entry>
<entry>
<title>Complete functionality and general cleanup</title>
<updated>2025-08-14T16:30:15+00:00</updated>
<author>
<name>Marcelo Domínguez</name>
<email>dmmarcelo27@gmail.com</email>
</author>
<published>2025-08-14T15:27:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=250d77e5d72fde69a6406050a3b037635f685378'/>
<id>urn:sha1:250d77e5d72fde69a6406050a3b037635f685378</id>
<content type='text'>
</content>
</entry>
</feed>
