diff --git a/tests/kfdtest/CMakeLists.txt b/tests/kfdtest/CMakeLists.txt index 39994dbff3..e175253dad 100644 --- a/tests/kfdtest/CMakeLists.txt +++ b/tests/kfdtest/CMakeLists.txt @@ -146,6 +146,7 @@ set (SRC_FILES gtest-1.6.0/gtest-all.cpp src/GoogleTestExtension.cpp src/IndirectBuffer.cpp src/Assemble.cpp + src/ShaderStore.cpp src/IsaGenerator.cpp src/IsaGenerator_Aldebaran.cpp src/IsaGenerator_Gfx10.cpp diff --git a/tests/kfdtest/src/KFDBaseComponentTest.hpp b/tests/kfdtest/src/KFDBaseComponentTest.hpp index ec3053c3d3..cc87465ad5 100644 --- a/tests/kfdtest/src/KFDBaseComponentTest.hpp +++ b/tests/kfdtest/src/KFDBaseComponentTest.hpp @@ -35,6 +35,7 @@ #include "OSWrapper.hpp" #include "KFDTestUtil.hpp" #include "Assemble.hpp" +#include "ShaderStore.hpp" // @class KFDBaseComponentTest class KFDBaseComponentTest : public testing::Test { diff --git a/tests/kfdtest/src/ShaderStore.cpp b/tests/kfdtest/src/ShaderStore.cpp new file mode 100644 index 0000000000..5f46bf844a --- /dev/null +++ b/tests/kfdtest/src/ShaderStore.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** + * Common + */ + +const char *NoopIsa = R"( + .text + s_endpgm +)"; + +const char *CopyDwordIsa = R"( + .text + v_mov_b32 v0, s0 + v_mov_b32 v1, s1 + v_mov_b32 v2, s2 + v_mov_b32 v3, s3 + flat_load_dword v4, v[0:1] glc slc + s_waitcnt 0 + flat_store_dword v[2:3], v4 glc slc + s_endpgm +)"; + +const char *InfiniteLoopIsa = R"( + .text + LOOP: + s_branch LOOP + s_endpgm +)"; + +const char *AtomicIncIsa = R"( + .text + v_mov_b32 v0, s0 + v_mov_b32 v1, s1 + .if (.amdgcn.gfx_generation_number >= 8) + v_mov_b32 v2, 1 + flat_atomic_add v3, v[0:1], v2 glc slc + .else + v_mov_b32 v2, -1 + flat_atomic_inc v3, v[0:1], v2 glc slc + .endif + s_waitcnt 0 + s_endpgm +)"; diff --git a/tests/kfdtest/src/ShaderStore.hpp b/tests/kfdtest/src/ShaderStore.hpp new file mode 100644 index 0000000000..2344c5bca2 --- /dev/null +++ b/tests/kfdtest/src/ShaderStore.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _SHADERSTORE_H_ +#define _SHADERSTORE_H_ + +/* Common */ +extern const char *NoopIsa; +extern const char *CopyDwordIsa; +extern const char *InfiniteLoopIsa; +extern const char *AtomicIncIsa; + +#endif // _SHADERSTORE_H_