After https://github.com/KhronosGroup/SPIRV-Tools/pull/6027 spirv-val is
now rejecting `Aligned 0` Memory Operands. This causes the spirv_new
test binary to no longer build with a recent SPIRV-Tools version.
Mechanically remove all occurrences of `Aligned 0` in the SPIR-V
assembly files.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
A recent improvement to the SPIR-V validator added checks to ensure the
**Float16** capability is declared when directly operating on fp16
values, which identified issues in one of our SPIR-V test files. This PR
fixes the SPIR-V files to add the missing capability.
Adds a basic test for the SPIR-V 1.6 UniformDecoration decorations.
Specifically:
* Tests both the Uniform and UniformId decorations.
* Tests the decorations on constants, function parameters, and
variables.
Add installation rules for all the binary targets.
Targets are installed under `<CMAKE_INSTALL_PREFIX>/bin/<CONFIG>` where
`<CONFIG>` is `CMAKE_BUILD_TYPE` for single-config generators, e.g. Unix
Makefiles and Ninja, or the build configuration for multi-config
generators, e.g. Ninja Multi-Config and Visual Studio.
This creates the target `install` on Unix and `INSTALL` on Windows.
Add custom commands and targets to automatically assemble and validate
the SPIR-V shaders used by the test.
Automatic assembly depends on finding `python3`, `spirv-as` and
`spirv-val`. `SPIRV_TOOLS_DIR` can be defined by the user during
configuration to provide an override path. Default behaviour assumes
that the binaries exist in `PATH`.
---------
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
fixes#2140
Adds testing for SPIR-V 1.5 features:
* Adds a test for bitcasts between pointers and vectors of integers.
Note, SPIR-V 1.5 only supports bitcasts to vectors of two 32-bit
integers. Therefore, the SPIR-V 1.5 behavior will only be exercised on
devices with 64-bit pointers. The test will run on devices with 32-bit
pointers, but will instead bitcast to scalars.
* Adds a test for OpGroupNonUniformBroadcast with a dynamic index. Note,
this is not an exhaustive test, and only unsigned integer types are
tested, to avoid duplicating testing for cl_khr_subgroup_ballot.
The following tests under `spirv_new`:
* `op_branch_conditional`
* `op_phi`
* `op_selection_merge`
were using randomly generated `cl_int` values, and storing the
difference between them as a `cl_int`. If one of the generated values is
negative and large enough, while the other is positive and large enough,
the difference then becomes a larger value that cannot be represented
using `cl_int`.
Switch the tests to use `cl_uint` instead, and update the relevant
spvasm{32,64} files to use `OpULessThan` instead of `OpSLessThan`.
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This PR adds targeted testing for a few remaining miscellaneous SPIR-V
1.4 features:
* Variables in the Function storage class can have a NonWriteable
decoration.
* OpCopyMemorySized can have two optional memory operands.
* OpSelect can have composite operands that are not vectors.
This PR adds targeted testing for more SPIR-V 1.4 features.
Specifically, this PR adds testing for OpDecorateString,
OpMemberDecorateString, and the UserSemantic decoration.
This PR adds targeted testing for SPIR-V 1.4 features. Specifically,
this PR adds testing for the NoSignedWrap and NoUnsignedWrap
decorations.
We can reuse large parts of the testing for the
`cl_khr_spirv_no_integer_wrap_decoration` extension to test the SPIR-V
1.4 feature.
This PR adds targeted testing for SPIR-V 1.4 features. Specifically,
this PR adds testing for:
1. The new Image Operand for SignExtend and ZeroExtend.
2. The new Loop Controls MinIterations, MaxIterations,
IterationMultiple, PeelCount, and PartialCount.
* Added cl_khr_fp16 extension support for test_decorate from spirv_new, work in progres
* Complemented test_decorate saturation test to support cl_khr_fp16 extension (issue #142)
* Fixed clang format
* scope of modifications:
-changed naming convention of saturation .spvasm files related to
test_decorate of spirv_new
-restored float to char/uchar saturation tests
-few minor corrections
* fix ranges for half testing
* fix formating
* one more formatting fix
* remove unused function
* use isnan instead of std::isnan
isnan is currently implemented as a macro, not as a function, so
we can't use std::isnan.
* fix Clang warning about inexact conversion
---------
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
* initial version of the test with placeholders for linkonce_odr linkage
* add OpExtension SPV_KHR_linkonce_odr extension
* add check for extension
* switch to actual LinkOnceODR linkage
* fix formatting
* add a test case to ensure a function with linkonce_odr is exported
* add back the extension check
* fix formatting
* undo compiler optimization and actually add the call to function a
* basic SPIR-V 1.3 testing support
* updated script to compile for more SPIR-V versions
* switch to general SPIR-V versions test
* update copyright text and fix license
* improve output while test is running
* check for higher SPIR-V versions first
* fix formatting
* Added cl_khr_fp16 extension support for test_op_vector_extract from spirv_new (issue #142)
* Added missing condition to test available cl_khr_fp16 extension
* Added cl_khr_fp16 extension support for test_op_vector_insert from spirv_new, work in progress.
* Added cl_khr_fp16 extension support for test_op_vector_insert from spirv_new (issue #142)
* Remove binaries for spirv_new (#21)
Avoid storing binaries in version control, as it is generally not well
suited to this. Instead, in a followup commit we will add a script to
regenerate the .spv files from their sources.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Add Python script to assemble spirv_new binaries (#21)
This also changes the ext_cl_khr_spirv_no_integer_wrap_decoration assembly
source so that the SPIR-V version is listed as 1.0, to ensure that the
output of spirv-dis exactly matches the assembly.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
The Volatile, Coherent, NonWritable and NonReadable decorations can
only be applied to images if they are storage images, which require
the Shader capability.
Note that in SPIR-V 1.4 and later, the NonWritable decoration can
also be applied to objects in the Private and Function storage classes
(although Private also requires the Shader capability), but this was
not covered by the existing test for the NonWritable decoration.
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* remove SPV_KHR_no_integer_wrap_decoration
* address review comments
* remove the assemble_spirv script
There is another PR in flight that adds a much more complete
script that we should merge instead.
* New spirv_new test case OpSpecConstant OpSpecConstantTrue OpSpecConstantfalse
* Register test case with minimal OpenCL version
* Specialization constant - add files uint/int cases
* Specialization constants - fix second build program
* Fix changes clang format.
* spirv_new - Make functions visible outside of main
* Fix clang format issues
* Fix int/uint 32 bit cases
* Fix minimal required version for test_op_spec_constant
* Remove not needed OpName. Update binaries
* Fix code format
* Remove op_spec_constant_int cases in spirv_new tests
* op_spec_constant - add simplified spirv files
* no redundant OpUConvert OpSConvert
* no redundant OpName
* instead of buffers scalar variable
* op_spec_constant - refactor to address review issues
* avoid using program that has already kernel program attached
* remove not used buffer
* Simplified test case - instead of buffers use scalar variable
* spirv_new - remove spec_const duplicated cases (singed versions)
* spirv_new - set clSetProgramSpecializationConstant before clBuildProgram
* Test spirv_new - fix spec const after rebase
* Test spirv_new - fix spec const set min version for bool type tests
The OpenCL SPIR-V Environment Specification was updated to mandate that
all variables decorated with `BuiltIn` must be in the `Input` storage
class, see https://github.com/KhronosGroup/OpenCL-Docs/pull/278.
Global variables with the Input storage class have to be listed in the
entry points’ interface, which was also taken care of in this commit.
* Reformat SPIR-V assembly using spirv-dis
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Fix duplicate non-aggregate type decls in SPIR-V as reported by spirv-val
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Reposition OpExtensions correctly in SPIR-V as reported by spirv-val
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Reposition OpVariables correctly in SPIR-V as reported by spirv-val
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Add missing OpTypeImage access qualifiers in SPIR-V as reported by spirv-val
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Remove same-width OpSConverts in SPIR-V as reported by spirv-val
Signed-off-by: Stuart Brady <stuart.brady@arm.com>
* Replace -ILPath with --spirv-binaries-path in README
Signed-off-by: Stuart Brady <stuart.brady@arm.com>