Conversation
| # FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented. | ||
| ./y.sh test --release --stdarch-tests -- --skip test_tile_ --skip test__tile | ||
| # Compiler-allocated __tile_* APIs are not supported yet. | ||
| ./y.sh test --release --stdarch-tests -- --skip test__tile |
There was a problem hiding this comment.
Keep a FIXME for --skip test__tile.
| # FIXME: these tests fail when the sysroot is compiled with LTO because of a missing symbol in proc-macro. | ||
| # FIXME: remove --skip test_tile_ and --skip --skip test__tile when it's implemented. | ||
| STDARCH_TEST_SKIP_FUNCTION="xsave,xsaveopt,xsave64,xsaveopt64" STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu CG_RUSTFLAGS="-Ainternal_features" ./y.sh cargo test --manifest-path build/build_sysroot/sysroot_src/library/stdarch/Cargo.toml -- --skip rtm --skip tbm --skip sse4a --skip test_tile_ --skip test__tile | ||
| # Compiler-allocated __tile_* APIs are not supported yet. |
| #[cfg(feature = "master")] | ||
| use rustc_middle::ty; | ||
| #[cfg(feature = "master")] | ||
| use rustc_middle::ty::layout::LayoutOf; |
There was a problem hiding this comment.
| #[cfg(feature = "master")] | |
| use rustc_middle::ty; | |
| #[cfg(feature = "master")] | |
| use rustc_middle::ty::layout::LayoutOf; | |
| #[cfg(feature = "master")] | |
| use rustc_middle::ty::{self, layout::LayoutOf}; |
| use crate::context::{CodegenCx, new_array_type}; | ||
| use crate::type_::{StructAttribute, apply_struct_attributes}; | ||
|
|
||
| /// Lower AMX operations whose tile operands name architectural registers, not SSA values. |
There was a problem hiding this comment.
| /// Lower AMX operations whose tile operands name architectural registers, not SSA values. | |
| /// Lower AMX operations whose tile operands name registers, not SSA values. |
| mut args: Cow<'b, [RValue<'gcc>]>, | ||
| func_name: &str, | ||
| ) -> Cow<'b, [RValue<'gcc>]> { | ||
| // FIXME: this might not be a good way to workaround the missing tile builtins. |
There was a problem hiding this comment.
Please also keep this comment.
| let sig = builder | ||
| .tcx | ||
| .fn_sig(instance.def_id()) | ||
| .instantiate(builder.tcx, instance.args) | ||
| .skip_norm_wip(); | ||
| let sig = builder.tcx.instantiate_bound_regions_with_erased(sig); |
There was a problem hiding this comment.
This code is not obvious to me, so please write a comment to explain this (perhaps not needed if the above comment is clearer).
| // GCC does not allocate these tile registers. Keep their implicit state changes, including | ||
| // operations with no memory effects, ordered with the other AMX operations. |
There was a problem hiding this comment.
This comment is not clear to me, so please clarify it.
| .skip_norm_wip(); | ||
| let sig = builder.tcx.instantiate_bound_regions_with_erased(sig); | ||
| let result_type = builder.backend_type(builder.layout_of(sig.output())); | ||
| Some(builder.current_func().new_local(builder.location, result_type, "amx_row")) |
There was a problem hiding this comment.
Please use Builder::new_temp instead of new_local.
| } else { | ||
| let sym = self.tcx.symbol_name(instance).name; | ||
| #[cfg(feature = "master")] | ||
| if let Some(result) = llvm::codegen_x86_amx(self, instance, sym, args) { |
There was a problem hiding this comment.
Please add a comment here to explain that it is OK for this call to be in the else since codegen_x86_amx does not insert in the cache.
| "llvm.x86.tilemovrow" => tile_row!("tilemovrow", "%k2", "r"), | ||
| "llvm.x86.tilemovrowi" => tile_row!("tilemovrow", "%2", "i"), |
There was a problem hiding this comment.
Instead of repeating "%k2", "r" and "%2", "i" on many lines, make the macro generate those by having something like this:
| "llvm.x86.tilemovrow" => tile_row!("tilemovrow", "%k2", "r"), | |
| "llvm.x86.tilemovrowi" => tile_row!("tilemovrow", "%2", "i"), | |
| "llvm.x86.tilemovrow" => tile_row!("tilemovrow", register), | |
| "llvm.x86.tilemovrowi" => tile_row!("tilemovrow", immediate), |
Replace the traps for the 15 fixed-register AMX intrinsics in #563. Use GCC builtins for tile configuration and volatile inline asm for the rest. Loads and stores carry memory clobbers so GCC cannot discard input writes or reuse stale output values.
Add assembly tests for both dialects, operand order and memory effects. Compiler-allocated tiles and newer AMX extensions are unchanged.
The assembly suite passes. All 15 upstream runtime cases passed under Intel SDE at -O0 and -O3; libcore, mini/std, Clippy and the no-default-features check also passed.
Fixes #563.