mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Revert "Switch to new compiler interface to get system routine"
This reverts commit 09bdd2ad09
.
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
7c70a14bc4
commit
ed1e3de54a
@ -34,7 +34,6 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_compilers.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
||||
#include "test.h"
|
||||
|
||||
@ -2010,12 +2009,24 @@ TEST_F(BuiltInTests, WhenGettingSipKernelThenReturnProgramCreatedFromIsaAcquired
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->builtins.reset(builtins);
|
||||
mockCompilerInterface->sipKernelBinaryOverride = mockCompilerInterface->getDummyGenBinary();
|
||||
|
||||
cl_int errCode = CL_BUILD_PROGRAM_FAILURE;
|
||||
auto p = Program::createBuiltInFromGenBinary(pContext, pContext->getDevices(), mockCompilerInterface->sipKernelBinaryOverride.data(), mockCompilerInterface->sipKernelBinaryOverride.size(), &errCode);
|
||||
ASSERT_EQ(CL_SUCCESS, errCode);
|
||||
errCode = p->processGenBinary(*pClDevice);
|
||||
ASSERT_EQ(CL_SUCCESS, errCode);
|
||||
|
||||
const auto &sipKernelInfo = p->getKernelInfo(static_cast<size_t>(0), rootDeviceIndex);
|
||||
|
||||
auto compbinedKernelHeapSize = sipKernelInfo->heapInfo.KernelHeapSize;
|
||||
auto sipOffset = sipKernelInfo->systemKernelOffset;
|
||||
ASSERT_GT(compbinedKernelHeapSize, sipOffset);
|
||||
|
||||
const SipKernel &sipKernel = builtins->getSipKernel(SipKernelType::Csr, *pDevice);
|
||||
|
||||
auto expectedMem = mockCompilerInterface->sipKernelBinaryOverride.data();
|
||||
EXPECT_EQ(0, memcmp(expectedMem, sipKernel.getSipAllocation()->getUnderlyingBuffer(), mockCompilerInterface->sipKernelBinaryOverride.size()));
|
||||
auto expectedMem = reinterpret_cast<const char *>(sipKernelInfo->heapInfo.pKernelHeap) + sipOffset;
|
||||
EXPECT_EQ(0, memcmp(expectedMem, sipKernel.getSipAllocation()->getUnderlyingBuffer(), compbinedKernelHeapSize - sipOffset));
|
||||
EXPECT_EQ(SipKernelType::Csr, mockCompilerInterface->requestedSipKernel);
|
||||
|
||||
p->release();
|
||||
mockCompilerInterface->releaseDummyGenBinary();
|
||||
}
|
||||
|
||||
@ -2025,22 +2036,6 @@ TEST_F(BuiltInTests, givenSipKernelWhenItIsCreatedThenItHasGraphicsAllocationFor
|
||||
EXPECT_NE(nullptr, sipAllocation);
|
||||
}
|
||||
|
||||
TEST_F(BuiltInTests, givenSipKernelWhenAllocationFailsThenItHasNullptrGraphicsAllocation) {
|
||||
auto executionEnvironment = new MockExecutionEnvironment;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto memoryManager = new MockMemoryManager(*executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
auto device = std::unique_ptr<RootDevice>(Device::create<RootDevice>(executionEnvironment, 0u));
|
||||
EXPECT_NE(nullptr, device);
|
||||
|
||||
memoryManager->failAllocate32Bit = true;
|
||||
|
||||
auto builtins = std::make_unique<BuiltIns>();
|
||||
const SipKernel &sipKern = builtins->getSipKernel(SipKernelType::Csr, *device);
|
||||
auto sipAllocation = sipKern.getSipAllocation();
|
||||
EXPECT_EQ(nullptr, sipAllocation);
|
||||
}
|
||||
|
||||
TEST_F(BuiltInTests, givenSameDeviceIsUsedWhenUsingStaticGetterThenExpectRetrieveSameAllocation) {
|
||||
const SipKernel &sipKern = pDevice->getBuiltIns()->getSipKernel(SipKernelType::Csr, pContext->getDevice(0)->getDevice());
|
||||
auto sipAllocation = sipKern.getSipAllocation();
|
||||
|
@ -19,6 +19,67 @@
|
||||
using namespace NEO;
|
||||
|
||||
namespace SipKernelTests {
|
||||
std::string getDebugSipKernelNameWithBitnessAndProductSuffix(std::string &base, const char *product) {
|
||||
std::string fullName = base + std::string("_");
|
||||
|
||||
if (sizeof(uintptr_t) == 8) {
|
||||
fullName.append("64_");
|
||||
} else {
|
||||
fullName.append("32_");
|
||||
}
|
||||
|
||||
fullName.append(product);
|
||||
return fullName;
|
||||
}
|
||||
|
||||
TEST(Sip, WhenSipKernelIsInvalidThenEmptyCompilerInternalOptionsAreReturned) {
|
||||
const char *opt = getSipKernelCompilerInternalOptions(SipKernelType::COUNT);
|
||||
ASSERT_NE(nullptr, opt);
|
||||
EXPECT_EQ(0U, strlen(opt));
|
||||
}
|
||||
|
||||
TEST(Sip, WhenRequestingCsrSipKernelThenProperCompilerInternalOptionsAreReturned) {
|
||||
const char *opt = getSipKernelCompilerInternalOptions(SipKernelType::Csr);
|
||||
ASSERT_NE(nullptr, opt);
|
||||
EXPECT_STREQ("-cl-include-sip-csr", opt);
|
||||
}
|
||||
|
||||
TEST(Sip, When32BitAddressesAreNotBeingForcedThenSipLlHasSameBitnessAsHostApplication) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
mockDevice->deviceInfo.force32BitAddressess = false;
|
||||
const char *src = getSipLlSrc(*mockDevice);
|
||||
ASSERT_NE(nullptr, src);
|
||||
if (sizeof(void *) == 8) {
|
||||
EXPECT_NE(nullptr, strstr(src, "target datalayout = \"e-p:64:64:64\""));
|
||||
EXPECT_NE(nullptr, strstr(src, "target triple = \"spir64\""));
|
||||
} else {
|
||||
EXPECT_NE(nullptr, strstr(src, "target datalayout = \"e-p:32:32:32\""));
|
||||
EXPECT_NE(nullptr, strstr(src, "target triple = \"spir\""));
|
||||
EXPECT_EQ(nullptr, strstr(src, "target triple = \"spir64\""));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Sip, When32BitAddressesAreBeingForcedThenSipLlHas32BitAddresses) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
mockDevice->deviceInfo.force32BitAddressess = true;
|
||||
const char *src = getSipLlSrc(*mockDevice);
|
||||
ASSERT_NE(nullptr, src);
|
||||
EXPECT_NE(nullptr, strstr(src, "target datalayout = \"e-p:32:32:32\""));
|
||||
EXPECT_NE(nullptr, strstr(src, "target triple = \"spir\""));
|
||||
EXPECT_EQ(nullptr, strstr(src, "target triple = \"spir64\""));
|
||||
}
|
||||
|
||||
TEST(Sip, GivenSipLlWhenGettingMetadataThenMetadataRequiredByCompilerIsReturned) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
const char *src = getSipLlSrc(*mockDevice);
|
||||
ASSERT_NE(nullptr, src);
|
||||
|
||||
EXPECT_NE(nullptr, strstr(src, "!opencl.compiler.options"));
|
||||
EXPECT_NE(nullptr, strstr(src, "!opencl.kernels"));
|
||||
}
|
||||
|
||||
TEST(Sip, WhenGettingTypeThenCorrectTypeIsReturned) {
|
||||
SipKernel csr{SipKernelType::Csr, nullptr};
|
||||
@ -48,6 +109,18 @@ TEST(DebugSip, givenDebuggingActiveWhenSipTypeIsQueriedThenDbgCsrSipTypeIsReturn
|
||||
EXPECT_LE(SipKernelType::DbgCsr, sipType);
|
||||
}
|
||||
|
||||
TEST(DebugSip, WhenRequestingDbgCsrSipKernelThenProperCompilerInternalOptionsAreReturned) {
|
||||
const char *opt = getSipKernelCompilerInternalOptions(SipKernelType::DbgCsr);
|
||||
ASSERT_NE(nullptr, opt);
|
||||
EXPECT_STREQ("-cl-include-sip-kernel-debug -cl-include-sip-csr -cl-set-bti:0", opt);
|
||||
}
|
||||
|
||||
TEST(DebugSip, WhenRequestingDbgCsrWithLocalMemorySipKernelThenProperCompilerInternalOptionsAreReturned) {
|
||||
const char *opt = getSipKernelCompilerInternalOptions(SipKernelType::DbgCsrLocal);
|
||||
ASSERT_NE(nullptr, opt);
|
||||
EXPECT_STREQ("-cl-include-sip-kernel-local-debug -cl-include-sip-csr -cl-set-bti:0", opt);
|
||||
}
|
||||
|
||||
TEST(DebugSip, givenBuiltInsWhenDbgCsrSipIsRequestedThanCorrectSipKernelIsReturned) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
|
Reference in New Issue
Block a user