Fix rawBufferVectorLoad/Store to widen min precision types to 32-bit#8274
Draft
alsepkow wants to merge 1 commit intomicrosoft:mainfrom
Draft
Fix rawBufferVectorLoad/Store to widen min precision types to 32-bit#8274alsepkow wants to merge 1 commit intomicrosoft:mainfrom
alsepkow wants to merge 1 commit intomicrosoft:mainfrom
Conversation
RawBufferVectorLoad/Store for min precision types (min16int, min16uint, min16float) was emitting i16/f16 vector operations (e.g., v3i16) which causes WARP and potentially other drivers to load/store 2 bytes per element instead of 4. This mismatches the buffer layout when the CPU writes 32-bit values. Pre-SM6.9 RawBufferLoad correctly handles this by loading as i32/f32 and truncating. Apply the same pattern for SM6.9 vector variants: - RawBufferVectorLoad: load as v_i32/v_f32, then trunc to i16/half - RawBufferVectorStore: sext/fpext to i32/f32, then store as v_i32/v_f32 This matches the existing bool widening pattern already in TranslateBufLoad. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes rawBufferVectorLoad/Store to use 32-bit element types (i32/f32) for min precision types (min16int, min16uint, min16float) instead of 16-bit (i16/f16). This matches how pre-SM6.9 RawBufferLoad handles min precision.
Resolves #8273
Root Cause
\TranslateBufLoad\ in \HLOperationLower.cpp\ creates the vector type directly from the min precision element type (i16/f16) without widening to i32/f32. This causes WARP (and potentially other drivers) to load/store 2 bytes per element instead of 4, mismatching the buffer layout.
Fix
Apply the same widening pattern used for bool types:
awBufferVectorLoad.v_i32/v_f32, then \ runc/\ptrunc\ back
awBufferVectorStore.v_i32/v_f32\
Testing
Added FileCheck test verifying all 3 min precision types produce i32/f32 vector load/store ops.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com