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.
Print the build log when building the program in `get_program_with_il`
fails, to make it easier to investigate spirv_new test failures.
Factor out a global helper function `OutputBuildLog` for printing the
build log for a single device.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Fixes several compile issues I am seeing for my version of Visual Studio
related to an ambiguous call to `fpclassify`, which is called by `isnan`
and other similar functions, specifically for the `cl_half` type:
```
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(401,1): error C2668: 'fpclassify': ambiguous call to overloaded function
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(298,31): message : could be 'int fpclassify(long double) throw()'
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(293,31): message : or 'int fpclassify(double) throw()'
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(288,31): message : or 'int fpclassify(float) throw()'
19>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h(401,1): message : while trying to match the argument list '(_Ty)'
```
Some of these issues seem like differences in compiler behavior, but at
least one appears to have identified a legitimate bug.
Specifically, this change:
* Removes the special-case checks for finite half numbers for commonfns,
since this is already handled by `UlpFn`. (test with: `test_commonfns
degrees radians`)
* Assigns to temporary variables to eliminate the ambiguous function
call for relationals. (test with: `test_relationals relational*`)
* Properly converts from half to float when checking for NaNs for
select. This is the one that seems like a legitimate bug. (test with:
`test_select select_half_ushort select_half_short`)
* Uses `std::enable_if` to disambiguate a function call for spirv_new.
(test with: `test_spirv_new decorate_saturated*`)
If it's helpful, my specific Visual Studio version is:
```
Microsoft Visual Studio Professional 2019
Version 16.11.20
VisualStudio.16.Release/16.11.20+32929.386
```
I also have the Windows Software Development Kit 10.0.19041.685
installed.
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 code base uses a mix of 'device' and 'deviceID'. I suggest we
standardise on 'device' which is shorter and slightly more prevalent.
Contributes to #2181
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
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>
test_copy_1D.cpp: num_mip_levels is a cl_uint, so don't cast and just
print using `%u`.
test_pipe_info.cpp: arg_type_qualifier is a 64-bit wide bitfield, so
print in hexadecimal format using the correct length modifier.
test_device_partition.cpp: it is not clear what the bit width of
`cl_device_partition_property` should be, so cast the operands to align
with the format specifiers.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@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.
Removes `using namespace std` and adds `std::` explicitly instead, which
is usually on calls to `min`.
This is generally best practice, and it also might be helpful when there
are the same function names in the std namespace and in the global
namespace (e.g. #1833).
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.
Fixes narrowing conversion build errors in test_common
Removing disable of narrowing errors in main CMakeLists.txt
and moving it down to specific test_conformance suite's
CMakeLists.txt where there are many more build errors revealed
from this fix.
Fixes a few simple issues under test_conformance in the process.
Contributes #787
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
---------
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
The verification code assumes the hardware uses CL_HALF_RTE, which
causes a mismatch computation results when the hardware uses RTZ. Fix to
use the hardware's default rounding mode.
test_decorate was checking for half-precision NAN incorrectly, calling
cl_half_from_float where cl_half_to_float was intended, causing a wrong
expected result.
test_decorate was also printing the expected and actual results
reversed, printing "got -1, want 0", when our implementation already
returned 0.
`log_error` was invoked from a template function, but the format
specifiers weren't adjusted for the template parameter types. Use a
stringstream for printing instead.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Using `GLOB` here breaks incremental builds when switching between
branches (e.g. when trying out a pull request). The CMake
documentation discourages use of `GLOB` to collect a list of source
files, so list all source files explicitly.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* 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
The source files for the spirv-new tests were using the older Khronos
license instead of the proper Apache license. Fixed the license in
all source files.
* 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)
In `os_helpers.cpp`, the preceding `if` already handles negative
values, so cast to unsigned.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The `cl_*` types need two levels of braces for initialization: the
outer braces for the union and the inner braces for the array.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Disabling of frem and fmod by b81b49e1 ("spirv: disable frem and fmod
tests for now (#1614)", 2023-02-07) introduced some new warnings about
multi-line `//` comments due to the trailing backslashes. Fix these.
Also fix a typo.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
The OpenCL SPIR-V Environment Specification does not require the SPIR-V
opcodes `OpFMod` and `OpFRem` to match any OpenCL C semantics, so
implementations implementing those two instructions according to Vulkan
and/or OpenGL semantics will fail those tests without actually violating
any OpenCL specification.
We should keep those tests disabled until we figure out what the actual
precision requierement should be and update the test accordingly.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
It only contains a pointer type definition for test functions that
really ought to be provided by testHarness.h.
Signed-off-by: Kévin Petit <kpet@free.fr>
Signed-off-by: Kévin Petit <kpet@free.fr>
`CMAKE_CXX_STANDARD` is already set in the top-level CMakeLists.txt
file, so there is no need to have it repeated for individual modules.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Remove unused variables throughout the code base and enable the
`-Wunused-variable` warning flag globally to prevent new unused
variable issues being introduced in the future.
This is mostly a non-functional change, with one exception:
- In `test_conformance/api/test_kernel_arg_info.cpp`, an error check
of the clGetDeviceInfo return value was added.
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
* Using helper functions for clCreateKernel
Uses of clCreateKernel following create program helper
functions, have been incorporated into
create_single_kernel_helper when suitable.
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Skip tests using clCompileProgram in offline mode
Contributes #31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Using type wrappers when using kernel helper functions
Also includes fix for windows build
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* Remove clReleaseKernel for wrapped kernel
Fixes#31
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* 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.
* Adds testing for CL_PROGRAM_IL
Added a test to check SpirV as an IL for programs built with IL
which includes a negative test for programs built without IL.
Added a test_fail macro.
Fixes#164
Change-Id: I908241242b369551806e43b90ab414f895d5c8f7
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* COMPUTE-11739 Removing unused platform and device_version
Fixes#164
Change-Id: Ib1168f6396132b69996d07166e1b593fa933d245
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
* 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