oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
218 stars 96 forks source link

Incoherent Documentation/Validation between zeModuleCreate and ze_module_desc_t #12

Closed Kerilk closed 4 years ago

Kerilk commented 4 years ago

Currently, the documentation of zeModuleCreate specifies that nullptr == desc->pConstants is an error, and the validation layer checks this. But the documentation of ze_module_desc_t specifies that pConstants must be set to nullptr if no specialization constants are provided.

Edit: The validation of zeModuleCreate also checks:

 if( 1 <= desc->format )
                  return ZE_RESULT_ERROR_INVALID_ENUMERATION;

But there exist two possible formats: ZE_MODULE_FORMAT_SPIRV (0) ZE_MODULE_FORMAT_NATIVE (1)

bmyates commented 4 years ago

Agreed, thanks for pointing this out. The intention here is that desc->pConstants is optional and nullptr should be an acceptable input. I'm working with our spec team to get the documentation updated, and we will post a fix to the validation layer soon. In the meantime, if you disable validation layer (or modify the code locally), passing nullptr for pConstants should work

Kerilk commented 4 years ago

Yes, for now I use an empty ze_module_constants_t.

As far as the second issue is concerned (the check on the enum value), I have found several other instances where the test should be strict inequality < rather than <=, so the logic used to generate those seems problematic.

bmyates commented 4 years ago

Agreed that is an issue in multiple places. Another issue is that some flag fields are validated incorrectly. We will have a fix for this in the near future.

Kerilk commented 4 years ago

These specific issues seem to have been fixed, I'll be closing this one to de-clutter.