HSA PRM (Programmer's Reference Manual) Specification revision: 1.0 Final (2015-03-06)
HSA PSA (Platform System Architecture) Specification revision: 1.0 Final (2015-01-23)
Test suite revision: 2015-05-25 (commit 281a954e86c63dd00c064d7c033e7ae46c524fe0)
HSA Conformance test suite is used to validate an implementation of Heterogeneous System Architecture for compliance with the following specifications:
- HSA PRM (Programmer's Reference Manual) Specification;
- HSA PSA (Platform System Architecture) Specification.
The focus is on verification of ISA produced by HSAIL Finalizer and functionality of kernels on the agent. HSAIL Linking extension is used to finalize test programs while HSA Core Runtime is used to set up and invoke test kernels and to provide certain functionality for test code on the host (for some tests).
A test consists of scenario which describes test data, HSAIL program(s) in BRIG format, agent(s) code, dispatches and validation. The test is deemed passed if all scenario steps (including validation) are successful. Many basic tests for HSAIL instruction contain just one program with one kernel, one or several input and output buffers (used to store test data and test results), one dispatch and validation of output buffer. An example of such test is a test for add_u32
HSAIL instruction: one kernel, two input buffers and one output buffer.
Note that each test actually expands into several testcases, one for each valid combination of parameters. These parameters are described in [Test details]. For example, a test for the abs instruction consists of several tests for f32
and f64
types.
HSA Conformance test suite uses CMake. The suite also requires the following components:
- HSAIL-Tools, included as HSAIL-Tools git submodule.
- HSA Runtime headers: hsa.h, hsa_ext_image.h, hsa_ext_finalize.h
cmake_windows.sh
and cmake_linux.sh
scripts contain examples of command lines that can be used to run CMake on Windows and Linux.
The test suite can be invoked as "hc" program that runs on the host.
To run the suite you should have a dynamic HSA RT libraries with corresponding bitness in the path (e.g. PATH
variable for Windows, LD_LIBRARY_PATH
for Linux).
A simple scenario of running all the tests on Linux 64-bit may look like:
export LD_LIBRARY_PATH="$HSA_RT_LIB:$LD_LIBRARY_PATH"
bin/lnx64a/hc -tests /
-exclude amdhsa.exclude
-runner hrunner
-verbose
-testlog results_linux64.log
where $HSA_RT_LIB
points to the HSA RT libraries, e.g.
/compiler/dist/Obsidian/dist/linux/debug.hsa_foundation/lib/x86_64
.
For convenience the package also contains Linux and Windows batch files, which take path to the HSA Runtime binaries and run the whole suite.
The following example demonstrates how to run these scripts on Linux. The results grouped by sub-suites will be displayed during the run along with overall statistics, per test results can be found in results_linux64.log:
$ ./run.sh /compiler/dist/Obsidian/dist/linux/debug.hsa_foundation/
prm/arithmetic/intfp/abs
Passed: 56 Failed: 0 Error: 0 NA: 0 Total: 56
prm/arithmetic/intfp/add
Passed: 255 Failed: 0 Error: 0 NA: 0 Total: 255
...
prm/special/misc/laneid
Passed: 24 Failed: 0 Error: 0 NA: 0 Total: 24
Testrun
Passed: 13729 Failed: 0 Error: 0 NA: 0 Total: 13729
Using -tests
option it is possible to specify a smaller set of tests, while -exclude
allows to exclude tests (e.g. failing due to issues with the current HSA RT implementation).
The "hc" supports the following command line options:
-tests TestSet
: prefix of test to run, e.g.-tests /
to run all tests or-tests prm/
to run only PRM tests;-exclude File
: file containing a list of tests to be excluded from testing;-verbose
: enables detailed test output in a log file;-testlog File
: name for a log file, the default name is test.log;-runner Runner
: a mode of test grouping. May be eitherhrunner
(default) orsimple
. By default tests are grouped by category.simple
runner may be specified to avoid tests grouping. See option-testloglevel
which also affects grouping.-testloglevel
: test grouping depth, the default is 4. See also-runner
option;-dump
: dump HSAIL and BRIG test sources for each test under corresponding folder (prm/...);-results
: path to folder which will contain dumped test sources (prm/...), the default is the current folder.
TODO: add example of how to interpret test output (both standard and detailed).
Every test has a unique identifier: test name. A test name consists of several words in lower case separated by slash (/
). First word is either prm
or sysarch
; it is the name of HSA specification this test checks compliance with. An example of test name is prm/special/dispatchpacket/dim/basic/kernel_1_200x1x1_64x1x1_ND
. The following scheme for the words is used (starting from the beginning of test name):
prm
: Test suite (prm
orsysarch
)special
: Chapter in PRM or PSA specificationdispatchpacket
: Section in PRM or PSA specificationdim
: Instruction or group of instructionsbasic
: Name of test/scenariokernel_1_200x1x1_64x1x1_ND
: Name/identifier of testcase within test. Fordim/basic
test, it is the testcase for dim instruction in kernel body with dispatch dimension1
, grid sizes200x1x1
, workgroup sizes64x1x1
and no control directives.
The naming scheme for testcases depends on test. For many tests, it contains text representation of parameters described in [Test details], separated by underscore (_). For some tests, simple counter is used. Refer to documentation below for the list of parameters.
A prefix of test names identifies test category. For example, prm/special/dispatchpacket/
are tests for dispatch packet operations. These categories may be used to select which tests to run (see option -tests
).
- Used sets:
All
: kernel, functionKernel
: just kernel
- Consists of:
- Number of dimensions
- Grid sizes for
x
,y
,z
. Unused dimensions have value1
. - Workgroup sizes for
x
,y
,z
. Unused dimensions have value1
.
- Used sets:
- All: various geometries, includes samples of partial workgroups/workitems, corner cases
DimensionSet
: representative geometry for each dimensionOneGroupSet
: one group, one dimension geometryDefaultPlusNGroupSet
: set of geometry with 1 WorkItem, OneGroupSet, and 1 dim & N groupsBoundary32Set
: samples of geometry with sizes> 2^32
Boundary24Set
: samples of geometry with sizes> 2^24
DegenerateSet
: samples of degenerated geometry when a dimension is used, but has size1
BarrierSet
: samples of one-dimensional geometries for barrier testingFBarrierSet
: special samples of geometries for fbarrier testingImageSet
: special samples of geometries for testing operations with images and samplesImageRdSet
: special samples of geometries for testing rdimage operationAtomicSet
: special samples of geometries for testing atomic operationsMModelSet
: special samples of geometries for testing memory model
- Control directives may be controlled with the following settings:
- Location: location of control directives (function, kernel or module).
- List of enabled control directives.
- A test shall use all possible combinations of enabled control directives. For example, if two directives are enabled -
requiredgridsize
andrequiredworkgroupsize
, the test shall use the following combinations:[]
(no control directives)[ requiredgridsize ]
[ requiredworkgroupsize ]
[ requiredgridsize, requiredworkgroupsize ]
- Used sets:
DimensionSet
: enabled directive isrequireddim
(directives affecting dimensions)GeometrySet
: enabled directives arerequireddim
,requiredgridsize
,requiredworkgroupsize
(directives affecting grid geometry)GridSizeSet
: enabled directives arerequireddim
,requiredgridsize
(directives affecting grid size)DegenerateSet
: enabled directives arerequiredgridsize
,requiredworkgroupsize
(directives affecting computation of operations that can be simplified for degenerate set)
- Used sets:
Atomic
: flat, global, groupHasFlatAddress
: global, group, private (segments which may be accessed via flat address)MemFence
: global, groupVariable
: global, readonly, kernarg, group, private, spill, argAll
: all standard segments
- Used sets:
All
: program, module, linkage, arg
- Used sets:
All
: all legal operands
- Used sets:
All
: all legal types
- Used sets:
All
: all legal types
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all operations
- Used sets:
All
: all atomic operationsAtomic
: all atomic operations except forld
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: rlx, screl, scacq, scarSignalAll
: rlx, screl, scacq, scarSignalWait
: rlx, screl, scacqMemFence
: screl, scacq, scar
- Used sets:
All
: wi, wv, wg, cmp, sysGlobal
: wv, wg, cmp, sysGroup
: wv, wg
- Used sets:
UpToWavesizeAndAll
: 1, 2, 4, 8, 16, 32, WAVESIZE, AllAll
: all legal values
- Used sets:
Standard
:- Includes the following values:
- regular values;
- boundary values (e.g. -128 and 127 for s8);
- special values (NaNs, infinities, subnormals, etc);
- values producing regular, boundary or special values as a result.
- Does not include the following values:
- values which signal exceptions;
- values which result in an undefined behavior.
- Includes the following values:
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: 1, 2, 10
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Used sets:
All
: all legal values
- Segment: Variable
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Instructions: abs, add, borrow, carry, div, max, min, mul, mulhi, neg, rem, sub, ceil, floor, fma, fract, rint, sqrt, trunc
- Operand Kind: All
- Dst Type: All
- Ftz: All
- Rounding: All
- Packed controls: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
Note: some tests for operations with f16
are not implemented yet.
Note: some tests for rounding modes are not implemented yet.
Note: tests for fma
with f64
type are not implemented yet.
- Instructions: mad
- Operand Kind: All
- Dst Type: All
- Ftz: All
- Rounding: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: mad24, mad24hi, mul24, mul24hi
- Operand Kind: All
- Dst Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: shl, shr
- Operand Kind: All
- Dst Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: and, or, xor, not, popcount
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: bitextract, bitinsert, bitmask, bitrev, bitselect, firstbit, lastbit
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: combine, expand, mov
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: shuffle, unpacklo, unpackhi, pack, unpack
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: cmov
- Operand Kind: All
- Dst Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
Note: some tests for rounding modes are not implemented yet.
- Instructions: class, copysign
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Packed controls: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: nsin, ncos, nlog2, nexp2, nsqrt, nrsqrt, nrcp, nfma
- Operand Kind: All
- Dst Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: bitalign, bytealign, lerp, packcvt, unpackcvt, sad, sadhi
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: cmp
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Compare Operation: All
- Ftz: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: cvt
- Operand Kind: All
- Dst Type: All
- Src Type: All
- Rounding: All
- Ftz: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
Note: some tests for operations with f16 are not implemented yet.
Note: some tests for rounding modes are not implemented yet.
- Instructions: stof, ftos, segmentp
- Segment: HasFlatAddress
- Grid Geometry: OneGroupSet
- Code Location: Kernel
identity: Verify that converted address accesses the same location as address before conversion [PRM, chapter 5.17]
- Instructions: stof, ftos
- Segment: HasFlatAddress
- SegmentStore: use segment store/flat load and not vice versa
- nonull: use nonull in the instruction
- Grid Geometry: OneGroupSet
- Code Location: Kernel
variable: Verify result of segmentp operation for flat address pointing to a variable [PRM, chapter 5.16]
- Instructions: segmentp
- Segment: HasFlatAddress
- nonull: use nonull in the instruction
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Instructions: lda
- Segment: HasFlatAddress
- nonull: use nonull in the instruction
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Instructions: ld, st
- Operand Kind: All
- Dst Type: All
- Segment: All
- Align: All
- Const: All
- Equiv: All
- Width: All
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
Note: tests for operations with b128
and opaque vectors are not implemented yet.
- Instructions: atomic, atomicnoret
- Operand Kind: All
- Dst Type: All
- Atomic operation: All
- Segment: Atomic
- Memory Order: All
- Memory Scope: All
- Equiv: 0
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: atomic, atomicnoret
- Operand Kind: All
- Dst Type: All
- Atomic operation: Atomic
- Segment: Atomic
- Memory Order: All
- Memory Scope: All
- Equiv: 0
- Grid Geometry: AtomicSet
- Code Location: Kernel
- Test Data: Standard
- Instructions: signal, signalnoret
- Memory Order: SignalAll, SignalWait
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Instructions: memfence
- Grid Geometry: OneGroupSet
- Code Location: Kernel
- Segment: Memfence
- Memory Order: Memfence
- Memory Scope: Global, Group
Tests are to be implemented.
- Grid Geometry: OneGroupSet
- Code Location: All
- Sampler Coord: All
- Sampler Filter: All
- Sampler Addressing: All
- Instructions: rdimage
- Grid Geometry: ImageRdSet
- Code Location: All
- Image Geometry: All
- Image Channel Order: All
- Image Channel Type: All
- Image Array: All
- Sampler Coord: All
- Sampler Filter: All
- Sampler Addressing: All
- Equiv: 0
- Instructions: ldimage
- Grid Geometry: ImageSet
- Code Location: All
- Image Geometry: All
- Image Channel Order: All
- Image Channel Type: All
- Image Array: All
- Equiv: 0
- Instructions: stimage
- Grid Geometry: ImageSet
- Code Location: All
- Image Geometry: All
- Image Channel Order: All
- Image Channel Type: All
- Image Array: All
- Equiv: 0
- Instructions: queryimage
- Grid Geometry: ImageSet
- Code Location: All
- Image Geometry: All
- Image Channel Order: All
- Image Channel Type: All
- Image Array: All
- Image Property: All
- Instructions: querysampler
- Grid Geometry: ImageSet
- Code Location: All
- Sampler Coord: All
- Sampler Filter: All
- Sampler Addressing: All
- Sampler Property: All
Tests are to be implemented.
basic/br: Basic unconditional jump, verify expected result by setting value of HSAIL register [PRM, chapter 8]
- Instructions: br
- Code Location: All
- Grid Geometry: OneGroupSet
- Instructions: cbr, sbr
- Grid Geometry: DefaultPlusNGroupSet
- Code Location: Kernel
- Width: UpToWavesizeAndAll
- Operand Kind: All
- Instructions: cbr, br
- Grid Geometry: DefaultPlusNGroupSet
- Code Location: Kernel
- Width: UpToWavesizeAndAll
- Operand Kind: All
- Instructions: cbr
- Grid Geometry: DefaultPlusNGroupSet
- Code Location: Kernel
- Width: UpToWavesizeAndAll
- Operand Kind: All
- Instructions: barrier
- Grid Geometry: BarrierSet
- Code Location: Kernel
- Segment: Atomic
- Memory Scope: All
- Memory Order: All
Tests for wavebarrier
are to be implemented.
- Instructions: initfbar, joinfbar, waitfbar, arrivefbar, leavefbar, releasefbar, ldf
- Grid Geometry: FBarrierSet
- Code Location: Kernel
- Instructions: activelanecount, activelaneid, activelanemask
- Grid Geometry: OneGroupSet
- Code Location: All
Tests for activelanepermute
are to be implemented.
- Types: all BRIG types
- Grid Geometry: OneGroupSet
- Code Location: All
More tests are to be implemented.
- Instructions: currentworkgroupsize, dim, gridgroups, gridsize, workgroupid, workgroupsize, workitemabsid, workitemflatabsid, workitemflatid, workitemid
- Code Location: All
- Grid Geometry: DimensionSet for dim, All for others
- Control Directives: DimensionSet for dim, GeometrySet for others
- Type: u32/u64 for gridsize, workitemflatabsid, workitemflatid, u32 for others
boundary32: Verify result of dispatch packet operation for workitems with workitemflatabsid around 2^32 boundary
- Instructions: gridsize, workitemflatabsid, workitemflatid
- Code Location: All
- Grid Geometry: Boundary32Set
- Control Directives: GridSizeSet
- Type: u32/u64
boundary24: Verify result of dispatch packet operation for possible mul24 finalizer optimizations around 2^24 boundary
- Instructions: workitemabsid, workitemflatabsid, workitemflatid
- Code Location: All
- Grid Geometry: Boundary24Set
- Control Directives: Boundary24Set
- Type: u32/u64 for workitemflatabsid, workitemflatid, u32 for other instructions
degenerate: Verify result of dispatch packet operation for used dimension that dispatched with size 1
- Instructions: currentworkgroupsize, gridgroups, gridsize, workgroupid, workgroupsize, workitemabsid, workitemflatid, workitemid
- Code Location: All
- Grid Geometry: DegenerateSet
- Control Directives: DegenerateSet
- Type: u32/u64 for workitemflatabsid, workitemflatid, u32 for other instructions
- Instructions: packetid
- Code Location: All
- Grid Geometry: Boundary32Set
- Control Directives: None
- Instructions: packetcompletionsig
- Code Location: All
- Grid Geometry: Boundary32Set
- Control Directives: None
- Grid Geometry: OneGroupSet
- Code Location: All or Kernel
- Exceptions mask: All (where applicable)
- Instructions: queueid, queueptr, ldk
- Grid Geometry: OneGroupSet
- Code Location: All
- Instructions: ldqueuereadindex, ldqueuewriteindex, addqueuewriteindex, casqueuewriteindex, stqueuereadindex, stqueuewriteindex
- Code Location: All
- Grid Geometry: OneGroupSet
- User mode queue type: separate, customized for each test
- Grid Geometry: OneGroupSet
- Code Location: All
kernargbaseptr/alignment: Verify alignment of kernargbaseptr depending on alignment of kernel arguments
- Grid Geometry: OneGroupSet
- Code Location: All
- Grid Geometry: OneGroupSet
- Code Location: All
- Code Locations: All
- Grid Geometry: All
- Code Locations: All
- Grid Geometry: All
- Code Locations: All
- Grid Geometry: All
- Grid Geometry: OneGroupSet
- Code Location: All or Kernel
- Code Locations: All
- Grid Geometry: All
- Code Locations: All
- Grid Geometry: All
- Code Locations: All
- Grid Geometry: All
- Code Locations: All
- Grid Geometry: All
laneid/sequence: Verify that result of laneid operation corresponds to work-items assigned to lanes in work-item flattened absolute ID order
- Code Locations: All
- Grid Geometry: All
Feature not implemented/not testable.
- Grid Geometry: OneGroupSet
- Code Location: All or Kernel
- Exceptions mask: All (where applicable)
Tests to be implemented.
- Grid Geometry: OneGroupSet
- Code Location: All
- Segment: Variable
- Linkage: All
Configuration/tests to be implemented.
- Grid Geometry: All
- Code Location: Kernel
- Instructions: atomic, atomicnoret, ld, st
- Operand Kind: All
- Dst Type: All
- Atomic operation: All
- Segment: Atomic
- Memory Order: All
- Memory Scope: All
- Equiv: 0
- Grid Geometry: MModelSet
- Code Location: Kernel
Information to be added when the suite is finalized.