Skip to content

Commit

Permalink
kfdtest: Fix ISA buffers not executable
Browse files Browse the repository at this point in the history
Fix for some places where the ISA buffers are not declared as
executable. Previous code in Thunk was blindly setting exec bit on all
memory allocations so this issue was masked.

Change-Id: Ic7a1169c69fb85ff9e8ea7bcc49a1845b37c08ff
  • Loading branch information
dayatsin-amd committed Sep 5, 2024
1 parent 545467b commit fe8d8c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions libhsakmt/tests/kfdtest/src/KFDLocalMemoryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST_F(KFDLocalMemoryTest, BasicTest) {
return;
}

HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaMemoryBuffer srcSysBuffer(BufferSize, defaultGPUNode, false);
HsaMemoryBuffer destSysBuffer(BufferSize, defaultGPUNode);
HsaMemoryBuffer srcLocalBuffer(BufferSize, defaultGPUNode, false, true);
Expand Down Expand Up @@ -151,7 +151,7 @@ TEST_F(KFDLocalMemoryTest, VerifyContentsAfterUnmapAndMap) {
return;
}

HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaMemoryBuffer SysBufferA(BufferSize, defaultGPUNode, false);
HsaMemoryBuffer SysBufferB(BufferSize, defaultGPUNode, true);
HsaMemoryBuffer LocalBuffer(BufferSize, defaultGPUNode, false, true);
Expand Down Expand Up @@ -296,7 +296,7 @@ TEST_F(KFDLocalMemoryTest, Fragmentation) {
HsaMemoryBuffer sysBuffer(PAGE_SIZE, defaultGPUNode, false);
PM4Queue queue;
ASSERT_SUCCESS(queue.Create(defaultGPUNode));
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);

ASSERT_SUCCESS(m_pAsm->RunAssembleBuf(CopyDwordIsa, isaBuffer.As<char*>()));

Expand Down
8 changes: 4 additions & 4 deletions libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST_P(KFDSVMRangeTest, BasicSystemMemTest) {
return;
}

HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaSVMRange srcSysBuffer(BufferSize, defaultGPUNode);
HsaSVMRange destSysBuffer(BufferSize, defaultGPUNode);

Expand Down Expand Up @@ -440,7 +440,7 @@ TEST_P(KFDSVMRangeTest, PartialUnmapSysMemTest) {
void *pBuf;

PM4Queue queue;
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaSVMRange *sysBuffer;
HsaSVMRange destSysBuffer(BufSize, defaultGPUNode);

Expand Down Expand Up @@ -497,7 +497,7 @@ TEST_P(KFDSVMRangeTest, BasicVramTest) {
return;
}

HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaSVMRange srcSysBuffer(BufferSize, defaultGPUNode);
HsaSVMRange locBuffer(BufferSize, defaultGPUNode, defaultGPUNode);
HsaSVMRange destSysBuffer(BufferSize, defaultGPUNode);
Expand Down Expand Up @@ -945,7 +945,7 @@ TEST_P(KFDSVMRangeTest, MigratePolicyTest) {
*/
//#define USE_PM4_QUEUE_TRIGGER_VM_FAULT
#ifdef USE_PM4_QUEUE_TRIGGER_VM_FAULT
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
PM4Queue queue;

ASSERT_SUCCESS(m_pAsm->RunAssembleBuf(CopyDwordIsa, isaBuffer.As<char*>()));
Expand Down
4 changes: 2 additions & 2 deletions libhsakmt/tests/kfdtest/src/RDMATest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TEST_F(RDMATest, GPUDirect) {
int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
ASSERT_GE(defaultGPUNode, 0) << "failed to get default GPU Node";

HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaMemoryBuffer srcSysBuffer(BufferSize, defaultGPUNode, false);
HsaMemoryBuffer srcLocalBuffer(BufferSize, defaultGPUNode, false, true);

Expand Down Expand Up @@ -130,7 +130,7 @@ TEST_F(RDMATest, ContiguousVRAMAllocation) {
return;
}

HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode);
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
HsaMemoryBuffer srcSysBuffer(PAGE_SIZE, defaultGPUNode, false);
void *LocalBuffer;
HsaMemFlags memFlags = {0};
Expand Down

0 comments on commit fe8d8c1

Please sign in to comment.