Commit Graph

69 Commits

Author SHA1 Message Date
Ben Ashbaugh
4fd42150bc add testing for SPIR-V 1.5 (#2208)
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.
2025-01-14 09:05:47 -08:00
Kévin Petit
5b7af4b36d [NFC] Change the name of the default device provided by the new registration framework (#2186)
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>
2024-12-12 13:24:04 -08:00
Kévin Petit
0a1456d8f9 [RFC] Move logic for test registration to the test harness (#2151)
And use in device_timer suite.

Signed-off-by: Kévin Petit <kpet@free.fr>
2024-11-26 09:55:09 -08:00
Ahmed Hesham
5d85fb3e3b Use cl_uint in some SPIR-V tests to avoid UB (#2159)
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>
2024-11-26 09:29:27 -08:00
Sven van Haastregt
e360d2de5b Fix various Wformat warnings (#2135)
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>
2024-11-26 09:25:38 -08:00
Ben Ashbaugh
e9a248f555 add SPIR-V 1.4 testing for OpCopyLogical (#2136)
This PR adds targeted testing for the SPIR-V 1.4 instruction
OpCopyLogical.
2024-11-25 07:35:50 -08:00
Ben Ashbaugh
b149060d52 add SPIR-V 1.4 testing for various miscellaneous additions (#2122)
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.
2024-11-11 12:39:00 -08:00
Ben Ashbaugh
c4119f07c1 add SPIR-V 1.4 testing for UserSemantic (#2053)
This PR adds targeted testing for more SPIR-V 1.4 features.
Specifically, this PR adds testing for OpDecorateString,
OpMemberDecorateString, and the UserSemantic decoration.
2024-10-31 07:12:30 -07:00
Ben Ashbaugh
d8228f0d72 remove using namespace std and use std namespace explicitly (#2125)
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).
2024-10-29 09:44:49 -07:00
Ben Ashbaugh
bc5f6cdfe8 add SPIR-V 1.4 testing for OpPtrEqual, OpPtrNotEqual, OpPtrDiff (#2054)
This PR adds targeted testing for the SPIR-V 1.4 instructions
OpPtrEqual, OpPtrNotEqual, and OpPtrDiff.
2024-10-29 09:36:26 -07:00
Ben Ashbaugh
ec6394488a add SPIR-V 1.4 testing for no integer wrap decorations (#2041)
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.
2024-10-22 09:47:57 -07:00
Ben Ashbaugh
94257defea add SPIR-V 1.4 testing for Image Operands and Loop Controls (#2034)
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.
2024-10-22 09:47:31 -07:00
ellnor01
617e7cb233 Re-enabling narrowing errors (#1144)
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>
2024-10-08 09:54:32 -07:00
Ben Ashbaugh
38ae617ca4 add testing for OpExpectKHR with boolean sources (#1904)
Adds a missing test case for OpExpectKHR with boolean sources.
2024-07-02 09:39:33 -07:00
Chuang-Yu Cheng
1cd0266ca1 spirv_new: fix test_decorate to use the device's default rounding (#1987)
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.
2024-07-02 09:29:00 -07:00
Harald van Dijk
c7b682f12a spirv_new: fix test_decorate. (#1980)
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.
2024-06-25 09:47:55 -07:00
Sven van Haastregt
5fe1cc01c0 spirv_new: fix -Wformat warnings (#1933)
`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>
2024-04-05 12:28:20 +02:00
Sven van Haastregt
ee504ba861 spirv_new: avoid GLOB for sources in CMakeLists (#1907)
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>
2024-03-11 10:13:13 +01:00
Ben Ashbaugh
0052af2227 add tests for cl_khr_expect_assume (#1888)
* initial support for cl_khr_expect_assume

Tests expect with 64-bit SPIR-V binaries.

* add support for assume testing with 64-bit binaries

* add 32-bit SPIR-V files

* fix formatting

* address review comments
2024-02-27 09:57:52 -08:00
Marcin Hajder
a4b5a30210 Added cl_khr_fp16 extension support for test_decorate from spirv_new (#1770)
* 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>
2024-02-13 09:22:32 -08:00
Ben Ashbaugh
a256e4ad05 add test for cl_khr_spirv_linkonce_odr (#1226)
* 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
2024-02-06 09:56:49 -08:00
Ben Ashbaugh
d5b7d10db7 add SPIR-V version testing (#1861)
* 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
2024-01-30 09:14:40 -08:00
Ben Ashbaugh
1260e7f5e0 fix the license header on the spirv-new tests (#1865)
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.
2024-01-16 09:58:34 -08:00
Marcin Hajder
40b3eb3f7f Added cl_khr_fp16 extension support for test_op_vector_extract from spirv_new (#1765)
* 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
2023-07-11 08:49:44 -07:00
Marcin Hajder
1e2d3522cf Added cl_khr_fp16 extension support for test_op_vector_insert from spirv_new (#1766)
* 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)
2023-07-11 08:48:41 -07:00
Marcin Hajder
73ead9da04 Added cl_khr_fp16 extension support for test_op_negate from spirv_new (#1762)
* Added cl_khr_fp16 extension support for test_op_negate from spirv_new (issue #142)

* Added clang format fix
2023-06-27 08:43:44 -07:00
Marcin Hajder
43c244f01d Added cl_khr_fp16 extension support for test vector_times_scalar from spirv_new (#1757)
* Added cl_khr_fp16 support for vector_times_scalar from spirv_new (issue #142, spirv_new)

* Logging correction
2023-06-27 08:42:56 -07:00
Sven van Haastregt
9798a96a9f [NFC] Fix some sign-compare warnings (#1670)
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>
2023-03-12 11:06:55 +00:00
Sven van Haastregt
dc8ee495bd [NFC] Fix -Wmissing-braces warnings (#1643)
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>
2023-03-02 09:28:51 +00:00
Sven van Haastregt
2c9526f9a5 [NFC] Fix multi-line comment warnings (#1641)
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>
2023-02-24 15:44:59 +00:00
Karol Herbst
b81b49e10e spirv: disable frem and fmod tests for now (#1614)
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>
2023-02-07 09:08:29 -08:00
Kévin Petit
1eeb10296f Get rid of threadTesting.h (#1604)
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>
2023-01-14 15:18:27 +00:00
Sven van Haastregt
a61fa63054 [NFC] cmake: Remove redundant CMAKE_CXX_STANDARD (#1558)
`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>
2022-11-04 08:53:42 -07:00
Sven van Haastregt
6554c49018 [NFCI] Remove unused variables and enable -Wunused-variable (#1483)
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>
2022-09-08 12:54:36 +01:00
Sven van Haastregt
e52a97e4e9 [NFC] Use Unix-style line endings (#1468)
Use the same line ending style across all source files.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2022-08-23 17:57:05 +01:00
Marco Antognini
7181bcdbac Rename files for consistency (#1166)
Signed-off-by: Marco Antognini <marco.antognini@arm.com>
2021-02-17 17:05:09 +00:00
ellnor01
25d9ff5d6e Using helper functions for clCreateKernel (#1064)
* 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>
2021-01-07 11:34:42 +00:00
Stuart Brady
337db8882a Remove spirv_new binaries and add Python script to generate them (#902)
* 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>
2020-10-30 14:38:39 +00:00
John Kesapides
e815bf3565 Fix min version for SPIRV test registration. (#1028)
Signed-off-by: John Kesapides <john.kesapides@arm.com>
2020-10-30 14:16:22 +00:00
Stuart Brady
f732cd5b7e Remove invalid SPIR-V image decoration tests (#22) (#958)
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>
2020-09-25 14:57:41 +01:00
Ben Ashbaugh
ab106e97f9 specialization constant test fixes (#927)
* 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.
2020-09-04 11:46:22 +01:00
ellnor01
a31e253397 Adds testing for CL_PROGRAM_IL (#919)
* 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>
2020-08-28 15:31:52 +01:00
Grzegorz Wawiorko
41cd9c6d98 New spirv_new test case OpSpecConstant (#719)
* 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
2020-08-20 00:39:06 +01:00
aarongreig
fb55f7e81c Set new minimum version for the spirv_new tests. (#854)
This allows 1.2 implementations with the cl_khr_il_program extension to run them.
2020-07-31 13:13:08 +01:00
Grzegorz Wawiorko
44a240367e Fix code format errors 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
c85527cec7 Review fixes - check error state 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
75dfd356d7 Review fixes - add clCreateProgramWithILKHR in linkage and op_opaque tests 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
9a006ba1a0 Spirv readiness - move to harness
Fixes support  cl_khr_il_program
2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
adec8f9412 Add support for cl_khr_il_program extension 2020-07-23 17:21:07 +01:00
Grzegorz Wawiorko
3730bce4e8 SPIR-V handling on different OpenCL devices version
Example usage for bruteforce and spirv_new
2020-07-23 17:21:07 +01:00