Skip to content

Add autocast support for x86amx#155264

Open
sayantn wants to merge 2 commits intorust-lang:mainfrom
sayantn:amx-autocast
Open

Add autocast support for x86amx#155264
sayantn wants to merge 2 commits intorust-lang:mainfrom
sayantn:amx-autocast

Conversation

@sayantn
Copy link
Copy Markdown
Contributor

@sayantn sayantn commented Apr 13, 2026

Builds on #140763 by further adding autocasts for x86amx from/to vectors of size 8192 bits.

This also disables SIMD vector abi checks for the "unadjusted" abi because

  • This is primarily used to link with LLVM intrinsics, which don't actually lower to function calls with vector arguments. Even with other cg backends, this is true.
  • This ABI is internal and perma-unstable (and also super specific), so it is very unlikely that this will cause breakages.
  • (The primary reason) Without doing this we can't actually use 8192 bit long vectors to represent x86amx

Why do we need a bypass for x86amx? Can't we use a #[lang_item] or something?

If x86amx was a normal LLVM type, this approach would've worked and I would also prefer it. But LLVM specifies that

No instruction is allowed for this type. There are no arguments, arrays, pointers, vectors or constants of this type.

So we can't treat it like a normal type at all -- even if we add it like a lang-item, we would still have to special-case everywhere to check if we are passing to the correct LLVM intrinsic, and only then use the x86amx type. IMO this is needlessly complex, and way worse than this solution, which just adds it to the autocast list in cg_llvm

r? codegen

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants