linking printf
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- testing-qa
Research direction
Start with the minimal Python reproduction in the issue and the two related C++ examples in OpenCL-CLHPP issue 316. Add coverage for one and two kernels containing printf, including an empty second source, checking compilation and linking and, where execution is available, the output. Done means the cases are represented in the conformance tests and their expected behavior is explicit.
Written by the indexing model from the issue text.
Description
clLinkProgram has issues with printf.
Consider this pyopencl example:
import pyopencl as cl
plattform = cl.get_platforms()[0]
device = plattform.get_devices()[0]
ctx = cl.Context([device])
queue = cl.CommandQueue(ctx)
src = r"""
kernel void tet() {
const long m = get_global_id(0);
printf("ID %ld\n", m);
}
"""
src2 = r"""
kernel void other() {
const long n = get_global_id(0);
printf("Do not print %ld\n", n);
}
"""
p = cl.Program(ctx, src).compile()
p2 = cl.Program(ctx, src2).compile()
program = cl.link_program(ctx, [p, p2])
program.tet(queue, (2,), None)
This should return
ID 0
ID 1
And using pocl with my CPU it does.
However, using Nvidia the linking segfaults.
Using AMD, I get the following:
ID 0
Do not print 4294967297
(null)
These problems are related to the presence of a printf in both kernels. If I get rid of one of them the issues disappear as well.
I have two related C++ examples here: https://github.com/KhronosGroup/OpenCL-CLHPP/issues/316
For some conditions linking “just” fails under Nvidia instead of a segfault. Nvidia can sometimes segfault with a printf in a single kernel as well though (see example in linked issue).
A test covering this (One kernel with a printf, two kernels with a printf) would be appreciated.
While part of the issue can be captured by testing if the kernels compile and can be linked, to capture what AMD is doing wrong, execution is required. And I do not know how to test that.
By the way, while testing this I removed the contents of src2. This is how I discovered, that passing an empty string (which should be completely valid, and can happen with generated code) also creates issues.
- Dominant language
- C++
- Stars
- 234
- Forks
- 240
- Avg merge
- 6d 12h
- Merged PRs (30d)
- 15
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from KhronosGroup/OpenCL-CTS
-
cognizant-backlog
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
KhronosGroup/OpenCL-CTS#2882 · 1 comment ·
Maintainers usually reply within 1 day
-
cl_khr_command_buffer: negative_enqueue_inconsistent_device expects CL_INCOMPATIBLE_COMMAND_QUEUE_KHR instead of CL_INVALID_DEVICEPossibly taken @kpet claimed this 11 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
KhronosGroup/OpenCL-CTS#2872 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
test_compiler: feature macros for cl_ext_float_atomics are not testedPossibly taken @shajder claimed this 10 days ago. Opencognizant-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/OpenCL-CTS#2818 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
KhronosGroup/OpenCL-CTS#2699 · 1 comment ·
Maintainers usually reply within 1 day
-
cleanup/refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
KhronosGroup/OpenCL-CTS#2057 ·
Maintainers usually reply within 1 day
All issues in KhronosGroup/OpenCL-CTS
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
useless statementOpen
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
grizzlypeak3d/DJV#962 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day