kfdtest: Add ShaderStore.cpp/hpp

Initial commit for ShaderStore.hpp. Will contain consts char*'s for
all shaders used within KFDTest.

The LLVM assembler now takes care of the correct instructions to be used
for various GFX versions using directives embedded into the shader assembly.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Change-Id: I2887a03b33d5c2cc382e4f96c2bc3e067715ab54
This commit is contained in:
Graham Sider
2021-11-02 13:45:08 -04:00
کامیت شده توسط Harish Kasiviswanathan
والد a7b85fdb08
کامیت 34ca37d9e8
4فایلهای تغییر یافته به همراه100 افزوده شده و 0 حذف شده
@@ -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
@@ -35,6 +35,7 @@
#include "OSWrapper.hpp"
#include "KFDTestUtil.hpp"
#include "Assemble.hpp"
#include "ShaderStore.hpp"
// @class KFDBaseComponentTest
class KFDBaseComponentTest : public testing::Test {
@@ -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
)";
@@ -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_