Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change stride to 4 instead of 1 if int8 is not supported #1397

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix comment
Rekt3421 committed Sep 23, 2024
commit 0fe6a7a1d26e2659bcd74712d2d6fd13eda96ceb
3 changes: 2 additions & 1 deletion lib/SPIRVProducerPass.cpp
Original file line number Diff line number Diff line change
@@ -2091,8 +2091,8 @@ SPIRVID SPIRVProducerPassImpl::getSPIRVType(Type *Ty, bool needs_layout) {
// Ops[2] = Stride Number(Literal Number)
Ops.clear();

// if stride is 1 automatically set it to 2 to avoid stride issues.
auto CurrStride = static_cast<uint32_t>(GetTypeAllocSize(EleTy, DL));
// if stride is 1 automatically set it to 4 to avoid stride issues.
Ops << RID << spv::DecorationArrayStride
<< getCorrectedStride(CurrStride);

@@ -6014,6 +6014,7 @@ void SPIRVProducerPassImpl::HandleDeferredDecorations() {
// Ops[1] = Decoration (ArrayStride)
// Ops[2] = Stride number (Literal Number)
SPIRVOperandVec Ops;
// if stride is 1 automatically set it to 4 to avoid stride issues.
Ops << id << spv::DecorationArrayStride << getCorrectedStride(stride);

addSPIRVInst<kAnnotations>(spv::OpDecorate, Ops);