Comments (5)
The root cause is the translation of
%conv = sext i8 %1 to i32
The i8 is mapped to a SPIR-V 32-bit unsigned int. But the conversion of the SExt doesn't take that into account.
Original OpenCL C:
kernel void bar(global int* A, global char4* B) {
*A = B->y;
}
last LLVM:
%0 = load <4 x i8>, <4 x i8> addrspace(1)* %B, align 4
%1 = extractelement <4 x i8> %0, i32 1
%conv = sext i8 %1 to i32
store i32 %conv, i32 addrspace(1)* %A, align 4
becomes SPIR-V:
%28 = OpLoad %uint %27
%29 = OpShiftRightLogical %uint %28 %uint_8
%30 = OpBitwiseAnd %uint %29 %uint_255
%31 = OpSConvert %uint %29 ; Not right because source type is too wide in SPIR-V
OpStore %26 %31
from clspv.
There's a corresponding problem with unsigned char.
from clspv.
Also sitofp i8 to float
kernel void bar(global float* A, global char4* B) {
*A = (float)(B->y);
}
Final LLVM:
%1 = extractelement <4 x i8> %0, i32 1
%conv = sitofp i8 %1 to float
store float %conv, float addrspace(1)* %A, align 4
becomes SPIR-V:
%29 = OpLoad %uint %28
%30 = OpShiftRightLogical %uint %29 %uint_8
%31 = OpBitwiseAnd %uint %30 %uint_255
%32 = OpConvertSToF %float %30
from clspv.
I can't reproduce a problem with unsigned char.
from clspv.
Default behaviour (when char support is enabled) is ok, but disabling char support is still problematic.
from clspv.
Related Issues (20)
- UNREACHABLE executed at lib/BitcastUtils.cpp:104 HOT 2
- incorrect execution for simple reduction sample HOT 5
- Segfaults when passing struct in global memory by value to a function. HOT 1
- Incorrectly warns about mixing code and declarations. HOT 9
- Q: how to trigger the use of uniform buffers. HOT 2
- clang generates definitions of sqrt
- Implement sampler mask using uniform buffer instead of push constant
- SimplifyPointerBitcast performs wrong simplification HOT 1
- math functions issue since instcombine transform "and" pattern to call to fabs HOT 1
- Invalid word count when emitting OpConstant HOT 3
- Segmentation fault HOT 1
- OpAtomicUMax may have the wrong pointer type after cast + offset HOT 1
- Temporary Bugfix: SimplifyPointerBitcastPass emits faulty IR that loses OpLoads of 16 bit fields HOT 2
- ReplacePointerBitcastPass introduces invalid IR with struct field of a struct HOT 3
- migrate from deprecated Type::isOpaquePointerTy() to Type::isPointerTy() HOT 1
- Ternary operator on AMD vk drivers. HOT 3
- Segmentation fault with conditional pointer assignment from different address spaces HOT 4
- Canonicalization of GEPs to i8 HOT 10
- Constant initialized global variable rewrites produce invalid IR
- Handle LLVM intrinsic llvm.is_fpclass
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clspv.