mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Receive spec consts from proper program source
Change-Id: I1e0ca9d2948190011fc1c75f24bdd8c3bb372daf Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
4f8325fa75
commit
a77209f5b7
@ -230,7 +230,7 @@ cl_int Program::setProgramSpecializationConstant(cl_uint specId, size_t specSize
|
||||
}
|
||||
|
||||
SpecConstantInfo specConstInfo;
|
||||
auto retVal = pCompilerInterface->getSpecConstantsInfo(this->getDevice(), ArrayRef<const char>(sourceCode), specConstInfo);
|
||||
auto retVal = pCompilerInterface->getSpecConstantsInfo(this->getDevice(), ArrayRef<const char>(irBinary.get(), irBinarySize), specConstInfo);
|
||||
|
||||
if (retVal != TranslationOutput::ErrorCode::Success) {
|
||||
return CL_INVALID_VALUE;
|
||||
|
@ -497,6 +497,9 @@ bool MockIgcOclTranslationCtx::GetSpecConstantsInfoImpl(
|
||||
CIF::Builtins::BufferSimple *src,
|
||||
CIF::Builtins::BufferSimple *outSpecConstantsIds,
|
||||
CIF::Builtins::BufferSimple *outSpecConstantsSizes) {
|
||||
uint32_t id = 1u;
|
||||
outSpecConstantsIds->PushBackRawCopy(id);
|
||||
outSpecConstantsSizes->PushBackRawCopy(sizeof(uint32_t));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2676,8 +2676,10 @@ struct SpecializationConstantProgramMock : public MockProgram {
|
||||
struct SpecializationConstantCompilerInterfaceMock : public CompilerInterface {
|
||||
TranslationOutput::ErrorCode retVal = TranslationOutput::ErrorCode::Success;
|
||||
int counter = 0;
|
||||
const char *spirV = nullptr;
|
||||
TranslationOutput::ErrorCode getSpecConstantsInfo(const NEO::Device &device, ArrayRef<const char> srcSpirV, SpecConstantInfo &output) override {
|
||||
counter++;
|
||||
spirV = srcSpirV.begin();
|
||||
return retVal;
|
||||
}
|
||||
void returnError() {
|
||||
@ -2714,6 +2716,15 @@ struct setProgramSpecializationConstantTests : public ::testing::Test {
|
||||
int specValue = 1;
|
||||
};
|
||||
|
||||
TEST_F(setProgramSpecializationConstantTests, whenSetProgramSpecializationConstantThenBinarySourceIsUsed) {
|
||||
auto retVal = mockProgram->setProgramSpecializationConstant(1, sizeof(int), &specValue);
|
||||
|
||||
EXPECT_EQ(1, mockCompiler->counter);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_TRUE(mockProgram->areSpecializationConstantsInitialized);
|
||||
EXPECT_EQ(mockProgram->irBinary.get(), mockCompiler->spirV);
|
||||
}
|
||||
|
||||
TEST_F(setProgramSpecializationConstantTests, whenSetProgramSpecializationConstantMultipleTimesThenSpecializationConstantsAreInitializedOnce) {
|
||||
auto retVal = mockProgram->setProgramSpecializationConstant(1, sizeof(int), &specValue);
|
||||
|
||||
|
Reference in New Issue
Block a user