Translator tests: every read of the imageblock parameter's value names ParameterValue (red)
The planner's ruling for a multi-cause refusal: name its typed cause. The imageblock parameter's value is refused by the memory planner before access::select_param's ParameterValue arm, as Lowering(Access) PointerSource or PointerStore (job m3-max-84446), so a walk's counts could not tell it from any other pointer source or store. every_read_of_the_imageblock_parameter_s_value_names_it covers the six shapes that job read, each checked by Unsupported::cause on every committed profile: - extractvalue of the parameter; - extractvalue through a freeze; - the extracted pointer through ptrtoint; - a store of the struct; - a round trip through an alloca; - insertvalue on the struct, then a store. the_imageblock_parameter_value_is_refused_where_it_is_read now expects Imageblocks with that cause, at the same place. Expected red: all six give Access PointerSource or PointerStore today.
This commit is contained in:
1 parent
f7b02f917a
commit
742e497f4b
1 file changed
+65
-4
@@ -429,7 +429,7 @@ fn a_cell_stride_is_rounded_up_to_the_alignment() {
|
||||
}
|
||||
|
||||
/// The imageblock parameter's own value (its `_imageblock_base` struct) has no lowered form: the
|
||||
/// `extractvalue` reading it is refused `Lowering(Access)` there.
|
||||
/// `extractvalue` reading it is refused there, naming `ImageblockCause::ParameterValue`.
|
||||
#[test]
|
||||
fn the_imageblock_parameter_value_is_refused_where_it_is_read() {
|
||||
let Some(bc) = assemble_text("value", ¶meter_value_kernel()) else {
|
||||
@@ -439,10 +439,11 @@ fn the_imageblock_parameter_value_is_refused_where_it_is_read() {
|
||||
match typed_module(&bc, "odd_stride", &p) {
|
||||
Err(Error::Unsupported(u)) => {
|
||||
assert_eq!(
|
||||
(u.feature, u.needs),
|
||||
(u.feature, u.needs, u.cause),
|
||||
(
|
||||
Feature::Lowering(LowerFamily::Access),
|
||||
Needs::NotImplemented
|
||||
Feature::Imageblocks,
|
||||
Needs::NotImplemented,
|
||||
Some(Cause::Imageblocks(ImageblockCause::ParameterValue))
|
||||
),
|
||||
"{stem}"
|
||||
);
|
||||
@@ -607,6 +608,66 @@ fn an_imageblock_of_no_cell_layout_is_refused_naming_its_layout() {
|
||||
refused_with_cause("layout", &text, ImageblockCause::Layout);
|
||||
}
|
||||
|
||||
/// Every read of the imageblock parameter's value that the memory planner meets names
|
||||
/// `ImageblockCause::ParameterValue`, by the root the pointer or the stored aggregate reaches (the
|
||||
/// parameter whose ABI role is the imageblock): a pointer extracted from it, through a `freeze`,
|
||||
/// or turned into an integer, and the struct stored to device memory, through the thread's
|
||||
/// memory, or with its pointer replaced by `insertvalue`.
|
||||
#[test]
|
||||
fn every_read_of_the_imageblock_parameter_s_value_names_it() {
|
||||
let s = "%\"struct.metal::_imageblock_base\"";
|
||||
let shapes = [
|
||||
("extract", parameter_value_kernel()),
|
||||
(
|
||||
"freeze",
|
||||
odd_stride_with(
|
||||
FIRST_CELL,
|
||||
&format!(" %fb = freeze {s} %block\n %cell = extractvalue {s} %fb, 0\n"),
|
||||
),
|
||||
),
|
||||
(
|
||||
"ptrtoint",
|
||||
odd_stride_with(
|
||||
FIRST_CELL,
|
||||
&format!(
|
||||
"{FIRST_CELL} %bp = extractvalue {s} %block, 0\n %bi = ptrtoint ptr \
|
||||
addrspace(4) %bp to i64\n store i64 %bi, ptr addrspace(1) %out, align 8\n"
|
||||
),
|
||||
),
|
||||
),
|
||||
(
|
||||
"store",
|
||||
odd_stride_with(
|
||||
FIRST_CELL,
|
||||
&format!("{FIRST_CELL} store {s} %block, ptr addrspace(1) %out, align 8\n"),
|
||||
),
|
||||
),
|
||||
(
|
||||
"alloca",
|
||||
odd_stride_with(
|
||||
FIRST_CELL,
|
||||
&format!(
|
||||
" %a = alloca {s}, align 8\n store {s} %block, ptr %a, align 8\n %cell = \
|
||||
load ptr addrspace(4), ptr %a, align 8\n"
|
||||
),
|
||||
),
|
||||
),
|
||||
(
|
||||
"insertvalue",
|
||||
odd_stride_with(
|
||||
FIRST_CELL,
|
||||
&format!(
|
||||
"{FIRST_CELL} %s2 = insertvalue {s} %block, ptr addrspace(4) %cell, 0\n \
|
||||
store {s} %s2, ptr addrspace(1) %out, align 8\n"
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
for (name, text) in &shapes {
|
||||
refused_with_cause(name, text, ImageblockCause::ParameterValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// An imageblock-space pointer that `air.imageblock_data` does not make, in a kernel, has no
|
||||
/// cell: `ImageblockCause::CellPointer`.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user