Comments (9)
Could you provide an example showing this message please?
from clspv.
Here is an example kernel:
#define uint32_t uint
__kernel
void foo
(
__global uint32_t* __restrict__ a,
__global uint32_t* __restrict__ b,
__global uint32_t* __restrict__ c
)
{
const uint32_t pindex = get_global_id(0);
uint32_t aa = a[pindex] * a[pindex];
if (aa < 1)
aa = 1;
uint32_t bb = b[pindex] * b[pindex];
if (bb < 1)
bb = 1;
c[pindex] = aa + bb;
}
Which will give the compiler warning:
$ ~/src/clspv/build/bin/clspv foo.cl
foo.cl:15:11: warning: mixing declarations and code is incompatible with standards before C99
15 | uint32_t bb = b[pindex] * b[pindex];
|
... which makes no sense, as OpenCL follows C99.
from clspv.
clspv
is build to enable all warnings, which is equivalent to compiling with -Weverything
.
Compiling a simple C code can produce the message even with C11:
$ clang -std=c11 test.c -Weverything
test.c:7:9: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
int toto = 0;
For more information: llvm/llvm-project#53438
@alan-baker should we add no-declaration-after-statement
in the warning list of clspv?
from clspv.
Note that the behavior is the same with gcc, expect that -Weverything
does not exist, thus one need to use -Wdeclaration-after-statement
to trigger the warning message (even with C11 or newer).
from clspv.
I think clspv needs to add a flag internally, because it will not accept it on its own command line:
~/src/clspv/build/bin/clspv -Wno-declaration-after-statement -o foo.spirv foo.cl
clspv: Unknown command line argument '-Wno-declaration-after-statement'. Try: '/home/bram/src/clspv/build/bin/clspv --help'
clspv: Did you mean '--enable-ext-tsp-block-placement'?
from clspv.
I don't think we want to make it configurable. Either we want to remove this warning from clspv, or we want to keep it like it is today.
Is this blocking something on your side for some reason?
from clspv.
No, it is not blocking. It is just unnecessary noise.
You can close it if you don't think it needs addressing.
from clspv.
I think this is worth discussing. Let's wait for @alan-baker opinion before closing it.
Thank you for reporting it.
from clspv.
I generally prefer to have as few deviations from clang as possible. If anything I'd rather expose an option that can be forwarded to clang to let the user control which warnings they want.
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
- 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.