Files
rocm-systems/projects/rocr-runtime/rocrtst
Yifan Zhang 12433d7a87 rocrtst: fix a test case setup issue in iommuv2 for APU
APU doesn't have non-KERNARG memory pool for cpu agent or
a global memory pool for gpu agent. Current setup check
fails as below. Change to a APU specific check method.

[==========] Running 45 tests from 5 test cases.
[----------] Global test environment set-up.
[----------] 1 test from rocrtst
[ RUN      ] rocrtst.Test_Example

    #### TEST NAME ####
Test Case Example

    #### TEST DESCRIPTION ####
Put a description of the test case here. Line breaks will be taken care of
on output, not here.

    #### TEST SETUP ####
The gpu device name is gfx902
Target HW Profile is HSA_PROFILE_FULL
Test can run on any profile. OK.
/home/jenkins/hsa/runtime/rocrtst/common/base_rocr_utils.cc:180: Failure
Value of: rocrtst::ProcessIterateError(err)
  Actual: 4096
Expected: HSA_STATUS_SUCCESS
Which is: 0
HSA_STATUS_ERROR: A generic error has occurred.
/home/jenkins/hsa/runtime/rocrtst/suites/test_common/test_case_template.cc:195: Failure
Value of: HSA_STATUS_SUCCESS
  Actual: 0
Expected: err
Which is: 4096
rocrtst64: /home/jenkins/hsa/runtime/rocrtst/common/base_rocr_utils.cc:416: hsa_kernel_dispatch_packet_t* rocrtst::WriteAQLToQueue(rocrtst::BaseRocR*, uint64_t*): Assertion `test->main_queue()' failed.
../shunit2: line 977:  1382 Aborted                 (core dumped) ./rocrtst$ROCRTST_BLD_BITS "$ROCRTST_ARGS" --gtest_output=xml:"$gtest_xml"
failed (failed to run rocrtst)

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Change-Id: I03691bd4171b6e622231baf3dce4db2211eb47e7


[ROCm/ROCR-Runtime commit: 5977eb554f]
2021-02-23 20:14:40 -05:00
..
2017-05-11 14:45:45 -04:00
2020-11-10 13:42:35 -05:00
2021-01-22 04:22:15 -05:00
2020-09-28 20:27:53 -05:00

Building rocrtst

Library dependencies

rocrtst needs hwloc and libnuma to build and run. On Debian systems, for example, you would need to get them like so:

sudo apt-get install libhwloc-dev libnuma-dev

CMake option values

When building rocrtst, several cmake command line options are available--some mandatory, some optional. These are described here:

  • TARGET_DEVICES=
    • Optional
    • semi-colon separated list of gpus to build kernels for; e.g. "gfx908;gfx900;...".
    • Default: the list of devices that is used is specified in the CMakeLists.txt file, and includes the all the currently supported targets.
  • ROCRTST_BLD_TYPE=<debug|release>
    • Optional
    • Build a debug or release build
    • Default: Build the debug version
  • CMAKE_PREFIX_PATH=<"ROCR root path; LLVM root path">
    • Required
    • Where to find ROCr and LLVM. The ROCr root path is typically something like /opt/rocm. The LLVM directory is typically something like /opt/rocm/llvm
  • CMAKE_INSTALL_PREFIX=""
    • Optional
    • Where to install rocrtst
  • CPACK_PACKAGING_INSTALL_PREFIX=""
    • Optional
    • Where to install rocrtst within DEB/RPM packages
  • CPACK_GENERATOR=
    • Optional
    • List of CPack build generators to use; e.g. "DEB;RPM"
  • ROCM_PATCH_VERSION=
    • Optional
    • ROCm patch version used in package name
  • ROCM_DIR=
    • Required
    • ROCm root directory
  • LLVM_DIR=""
    • Required
    • Location of clang executable
  • OPENCL_DIR=
    • Required
    • Location where OpenCL root resides
  • EMULATOR_BUILD=<true|false>
    • Optional
    • If EMULATOR_BUILD is defined, rocrtst will avoid tests that typically run too long on an HW emulator, or use a scaled-down version of the test.

Steps to build

mkdir build
cd build
# See description of these options above.
# The values for these options are examples. They should be tailored
# for your system.
cmake -DTARGET_DEVICES=$GPU_LIST \
  -DROCRTST_BLD_TYPE=$ROCRTST_BUILD_TYPE \
  -DCMAKE_PREFIX_PATH="$PACKAGE_ROOT;$PACKAGE_ROOT/llvm" \
  -DCMAKE_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \
  -DCPACK_PACKAGING_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \
  -DCPACK_GENERATOR="DEB;RPM" \
  -DROCM_PATCH_VERSION=$ROCM_LIBPATCH_VERSION \
  -DROCM_DIR=$PACKAGE_ROOT \
  -DLLVM_DIR="$PACKAGE_ROOT/llvm/bin" \
  -DOPENCL_DIR=$PACKAGE_ROOT \
  -DEMULATOR_BUILD=$EMULATOR_BUILD \
      ..
# Build rocrtst executable
make
# Build rocrtst kernels
make rocrtst_kernels

Running rocrtst

rocrtst needs to be able to find the ROCr library. This can be through ldconfig method or by setting LD_LIBRARY_PATH to have the ROCr library directory. When rocrtst is built, there is one rocrtst executable, and several symlinks pointing to that executable, one from each asic sub-directory. For example, for gfx900, we would see the following:

cd <rocrtst bin root>/gfx900
ls -l rocrtst
lrwxrwxrwx 1 user user 12 Sep 28 17:23 rocrtst64 -> ../rocrtst64

To run rocrtst, we should call the ASIC specific symlink. This allows the asic-specific kernels to be found.

rocrtst is a Google Test ("gtest") based program and accepts gtest options. Additionally, there are some rocrtst specfic options. All of these options can be seen by using the "-h" option:

$ <rocrtst bin>/gfx900 $ ./rocrtst64 -h
<GTest option descrption>
Optional RocRTst Arguments:
--iterations, -i <number of iterations to execute>; override default, which varies for each test
--rocrtst_help, -r print this help message
--verbosity, -v <verbosity level>
  Verbosity levels:
   0    -- minimal; just summary information
   1    -- intermediate; show intermediate values such as intermediate perf. data
   2    -- progress; show progress displays
   >= 3 -- more debug output
--monitor_verbosity, -m <monitor verbosity level>
  Monitor Verbosity levels:
   0    -- don't read or print out any GPU monitor information;
   1    -- print out all available monitor information before the first test and after each test
   >= 2 -- print out even more monitor information (test specific)