mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
brw: Add more safeguards against misaligned OWord Block messages
HDC doesn't support block loads/stores with sub-DWord (<4B) aligned offsets, and shared local memory has to use the Aligned OWord Block messages which require OWord (16B) alignment. Make the validator detect this case and say no. Also make the lowering code assert that the alignment is valid as a second line of defense. LSC has no such restrictions. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32888>
This commit is contained in:
parent
2f334e8baf
commit
c8b2ab041e
2 changed files with 14 additions and 5 deletions
|
|
@ -108,6 +108,13 @@ validate_memory_logical(const fs_visitor &s, const fs_inst *inst)
|
|||
fsv_assert(is_ud_imm(inst->src[MEMORY_LOGICAL_COMPONENTS]));
|
||||
fsv_assert(is_ud_imm(inst->src[MEMORY_LOGICAL_FLAGS]));
|
||||
|
||||
enum lsc_opcode op = (enum lsc_opcode) inst->src[MEMORY_LOGICAL_OPCODE].ud;
|
||||
enum memory_flags flags = (memory_flags)inst->src[MEMORY_LOGICAL_FLAGS].ud;
|
||||
bool transpose = flags & MEMORY_FLAG_TRANSPOSE;
|
||||
bool include_helpers = flags & MEMORY_FLAG_INCLUDE_HELPERS;
|
||||
enum memory_logical_mode mode =
|
||||
(memory_logical_mode)inst->src[MEMORY_LOGICAL_MODE].ud;
|
||||
|
||||
enum lsc_data_size data_size =
|
||||
(enum lsc_data_size) inst->src[MEMORY_LOGICAL_DATA_SIZE].ud;
|
||||
unsigned data_size_B = lsc_data_size_bytes(data_size);
|
||||
|
|
@ -117,12 +124,13 @@ validate_memory_logical(const fs_visitor &s, const fs_inst *inst)
|
|||
data_size == LSC_DATA_SIZE_D16U32 ||
|
||||
data_size == LSC_DATA_SIZE_D32 ||
|
||||
data_size == LSC_DATA_SIZE_D64);
|
||||
}
|
||||
|
||||
enum lsc_opcode op = (enum lsc_opcode) inst->src[MEMORY_LOGICAL_OPCODE].ud;
|
||||
enum memory_flags flags = (memory_flags)inst->src[MEMORY_LOGICAL_FLAGS].ud;
|
||||
bool transpose = flags & MEMORY_FLAG_TRANSPOSE;
|
||||
bool include_helpers = flags & MEMORY_FLAG_INCLUDE_HELPERS;
|
||||
if (transpose) {
|
||||
const unsigned min_alignment =
|
||||
mode == MEMORY_MODE_SHARED_LOCAL ? 16 : 4;
|
||||
fsv_assert(inst->src[MEMORY_LOGICAL_ALIGNMENT].ud >= min_alignment);
|
||||
}
|
||||
}
|
||||
|
||||
fsv_assert(!transpose || !include_helpers);
|
||||
fsv_assert(!transpose || lsc_opcode_has_transpose(op));
|
||||
|
|
|
|||
|
|
@ -1671,6 +1671,7 @@ lower_hdc_memory_logical_send(const fs_builder &bld, fs_inst *inst)
|
|||
*/
|
||||
const bool oword_aligned = block && mode == MEMORY_MODE_SHARED_LOCAL;
|
||||
assert(!oword_aligned || (alignment % 16) == 0);
|
||||
assert(!block || (alignment % 4) == 0);
|
||||
|
||||
enum lsc_addr_size addr_size = lsc_addr_size_for_type(addr.type);
|
||||
unsigned addr_size_B = coord_components * lsc_addr_size_bytes(addr_size);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue