Includes a simple AssembleShader test which loops through all shaders
for all supported targets, dispatching a RunAssemble call for each
shader.

Also adds extra safety on a couple shaders that only work on
gfx9/gfx90a.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
Change-Id: I3ca1c92136f3871eb62fcb9645694f22287aaeec
Этот коммит содержится в:
Graham Sider
2022-03-09 10:47:27 -05:00
коммит произвёл Harish Kasiviswanathan
родитель 025c6146d9
Коммит 7eeba830f8
6 изменённых файлов: 157 добавлений и 11 удалений
+1
Просмотреть файл
@@ -169,6 +169,7 @@ set (SRC_FILES gtest-1.6.0/gtest-all.cpp
src/KFDDBGTest.cpp
src/KFDGWSTest.cpp
src/KFDIPCTest.cpp
src/KFDASMTest.cpp
src/KFDEvictTest.cpp
src/KFDHWSTest.cpp
+2
Просмотреть файл
@@ -43,6 +43,8 @@
#ifndef _ASSEMBLE_H_
#define _ASSEMBLE_H_
#include "OSWrapper.hpp"
#define ASM_MCPU_LEN 16
class Assembler {
+73
Просмотреть файл
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2022 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.
*
*/
#include "GoogleTestExtension.hpp"
#include "KFDASMTest.hpp"
#include "ShaderStore.hpp"
#include "Assemble.hpp"
void KFDASMTest::SetUp() {}
void KFDASMTest::TearDown() {}
static const std::vector<uint32_t> TargetList = {
0x080001,
0x080002,
0x080003,
0x080005,
0x080100,
0x090000,
0x090002,
0x090004,
0x090006,
0x090008,
0x090009,
0x09000a,
0x09000c,
0x0a0100,
0x0a0101,
0x0a0102,
0x0a0103,
0x0a0300,
0x0a0301,
0x0a0302,
0x0a0303,
0x0a0304,
0x0a0305,
0x0a0306,
};
TEST_F(KFDASMTest, AssembleShaders) {
TEST_START(TESTPROFILE_RUNALL)
for (auto &t : TargetList) {
Assembler asmblr(t);
LOG() << "Running ASM test for target " << asmblr.GetTargetAsic() << std::endl;
for (auto &s : ShaderList) {
EXPECT_SUCCESS(asmblr.RunAssemble(s));
}
}
TEST_END
}
+39
Просмотреть файл
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2022 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 __KFD_ASM_TEST__H__
#define __KFD_ASM_TEST__H__
#include <gtest/gtest.h>
class KFDASMTest : public testing::Test {
public:
KFDASMTest() {}
~KFDASMTest() {}
protected:
virtual void SetUp();
virtual void TearDown();
};
#endif // __KFD_ASM_TEST__H__
+37 -11
Просмотреть файл
@@ -21,6 +21,30 @@
*
*/
#include "ShaderStore.hpp"
/**
* KFDASMTest List
*/
const std::vector<const char*> ShaderList = {
NoopIsa,
CopyDwordIsa,
InfiniteLoopIsa,
AtomicIncIsa,
ScratchCopyDwordIsa,
PollMemoryIsa,
CopyOnSignalIsa,
PollAndCopyIsa,
WriteFlagAndValueIsa,
WriteAndSignalIsa,
LoopIsa,
IterateIsa,
ReadMemoryIsa,
GwsInitIsa,
GwsAtomicIncreaseIsa,
};
/**
* Macros
*/
@@ -251,7 +275,7 @@ const char *PollAndCopyIsa = R"(
s_store_dword s17, s[2:3], 0x0 glc
s_waitcnt vmcnt(0) & lgkmcnt(0)
buffer_wbl2
.else
.elseif (.amdgcn.gfx_generation_number == 9)
s_movk_i32 s18, 0x1
LOOP:
s_load_dword s16, s[0:1], 0x0 glc
@@ -277,16 +301,18 @@ const char *PollAndCopyIsa = R"(
const char *WriteFlagAndValueIsa = R"(
.text
// Assume two inputs buffer in s[0:1] and s[2:3]
v_mov_b32 v0, s0
v_mov_b32 v1, s1
s_load_dword s18, s[2:3], 0x0 glc
s_waitcnt vmcnt(0) & lgkmcnt(0)
s_store_dword s18, s[0:1], 0x4 glc
s_waitcnt vmcnt(0) & lgkmcnt(0)
buffer_wbl2
s_waitcnt vmcnt(0) & lgkmcnt(0)
v_mov_b32 v16, 0x1
flat_store_dword v[0:1], v16 glc
.if (.amdgcn.gfx_generation_number == 9 && .amdgcn.gfx_generation_stepping == 10)
v_mov_b32 v0, s0
v_mov_b32 v1, s1
s_load_dword s18, s[2:3], 0x0 glc
s_waitcnt vmcnt(0) & lgkmcnt(0)
s_store_dword s18, s[0:1], 0x4 glc
s_waitcnt vmcnt(0) & lgkmcnt(0)
buffer_wbl2
s_waitcnt vmcnt(0) & lgkmcnt(0)
v_mov_b32 v16, 0x1
flat_store_dword v[0:1], v16 glc
.endif
s_endpgm
)";
+5
Просмотреть файл
@@ -24,6 +24,11 @@
#ifndef _SHADERSTORE_H_
#define _SHADERSTORE_H_
#include <vector>
/* KFDASMTest List */
extern const std::vector<const char*> ShaderList;
/* Common */
extern const char *NoopIsa;
extern const char *CopyDwordIsa;