Closed MrSidims closed 3 months ago
How will this implementation behave for the following LLVM IR:
%common_dummy_ptr_generated_by_user = getelementptr ptr addrspace(1), ptr addrspace(1) %ptr, i32 0
call void @read0(ptr addrspace(1) %common_dummy_ptr_generated_by_user), !spirv.DecorationCacheControlINTEL !0
call void @read1(ptr addrspace(1) %common_dummy_ptr_generated_by_user), !spirv.DecorationCacheControlINTEL !3
!0 = !{!1, !2}
!1 = !{i32 6442, i32 0, i32 3, i32 0} ; LoadCacheControlINTEL, CacheLevel = 0, InvalidateAfterRead
!2 = !{i32 6442, i32 1, i32 1, i32 0} ; LoadCacheControlINTEL, CacheLevel = 1, Cached
!3 = !{!4, !5}
!4 = !{i32 6442, i32 0, i32 0, i32 0} ; LoadCacheControlINTEL, CacheLevel = 0, Uncached
!5 = !{i32 6442, i32 1, i32 0, i32 0} ; LoadCacheControlINTEL, CacheLevel = 1, Uncached
Is my understanding correct that the SPIRVWriter will detect GEP0 generated by a user and therefore it'll try to assign all the decorations to the same pointer?
@aratajew Sorry, I incidentally edited your comment instead of mine, restore the original one.
Is my understanding correct that the SPIRVWriter will detect GEP0 generated by a user and therefore it'll try to assign all the decorations to the same pointer?
Correct, that is what would happen.
So it seems incorrect. User expected to execute:
foo
with InvalidateAfterRead
for level 0 and Cached
for level 1,boo
with Uncached
for level 0 and Uncached
for level 1.
I think that SPIRVWriter should always generate a new GEP for each function call. And it should ensure that only one GEP is generated for one function call's argument.As a NIT, we could be using SmallPtrSet
instead of std::vector
, but I'm fine with current approach.
My approval is "grey" here, so you'll need a proper review to merge
All of the tests are unrelated and will be fixed in https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/2602
In this case zero GEP will be created a single time, all the decorations will be attached to it.