Skip to content

add cl_offline_compiler.example#2684

Open
karolherbst wants to merge 1 commit into
KhronosGroup:mainfrom
karolherbst:cl_offline_compiler
Open

add cl_offline_compiler.example#2684
karolherbst wants to merge 1 commit into
KhronosGroup:mainfrom
karolherbst:cl_offline_compiler

Conversation

@karolherbst
Copy link
Copy Markdown
Contributor

Now that we require SPIR-V everywhere, we should make it easier for implementations to actually test tests in the SPIR-V mode.

This file can be tweaked according to runtime details, but it should provide a good base already and it's what I'm using in my testing.

There are a few gaps in handling extensions properly, but my hope is that we can collectively improve on this one to make it viable to be used across many different implementations.

Now that we require SPIR-V everywhere, we should make it easier for
implementations to actually test tests in the SPIR-V mode.

This file can be tweaked according to runtime details, but it should
provide a good base already and it's what I'm using in my testing.
#
# optional arguments:
# --source FILE OpenCL C source file to compile
# --output FILE SPIR-V or binary file to create
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, compilers use the -o FILE for output, so we should try to match that

# BUILD_OPTIONS additional options to pass to the compiler
#
# optional arguments:
# --source FILE OpenCL C source file to compile
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need a --source command line opt at all.
Most compiler take this as a positional argument, so we could match that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how the CTS is using it, I just copied this comment from from test_common/harness/cl_offline_compiler-interface.txt

# --source FILE OpenCL C source file to compile
# --output FILE SPIR-V or binary file to create
# --cl-device-info FILE OpenCL device info file
# --mode compilation mode (spir-v or binary)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really need to be explicit, right? We could infer this by the output file extension (.spv or .bin).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.. sure but I'd rather not change the interface in case anybody else is also using this interface already, so the plan was here to just implement it as expected.

if info[0] == '#':
continue
info = info.strip('\r\n')
split = info.split('=')
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering.. does anybody know of a good library to parse those kind of property files so we don't have to do it in a terrible way like here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this feels like the INI config parsing that we have in Python's configparser: https://docs.python.org/3/library/configparser.html
Would that work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants