KhronosGroup / KhronosGroup/OpenCL-Docs

printf format string

Open
#1,325 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
420
Forks
131
Avg merge
5d 13h
Merged PRs (30d)
11

Description

I want to clarify something about `printf`'s `format` argument.
The spec says:

> The format is in the constant address
space and must be resolvable at compile time, i.e. cannot be dynamically created by the executing
program itself.

Does it mean that `format` may be a kernel argument rather than a string literal? For example:

`__kernel void f(__constant char* arg) {
printf(arg);
}`

I don't see any such code in the CTS. I prefer this code to be disallowed. If you agree, I'll upload a change to the spec to clarify this.

Contributor guide

Open the contributing guide

Research direction

Review the printf format requirement in the OpenCL specification and the CTS coverage mentioned in the issue. Evaluate the shown __constant char* kernel-argument example; done means the specification explicitly resolves whether it is allowed, with any needed CTS coverage identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.