mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Enable ocloc disasm for .gen files
This commit allows to use "disasm" ocloc option to be used with .gen files. Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
14954acd12
commit
cc0c98e974
@ -6,7 +6,9 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/array_count.h"
|
||||
#include "shared/test/common/helpers/test_files.h"
|
||||
|
||||
#include "opencl/test/unit_test/offline_compiler/mock/mock_argument_helper.h"
|
||||
#include "opencl/test/unit_test/test_files/patch_list.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@ -43,32 +45,6 @@ TEST(DecoderTests, WhenParsingValidListOfParametersThenReturnValueIsZero) {
|
||||
EXPECT_EQ(0, decoder.validateInput(args));
|
||||
}
|
||||
|
||||
TEST(DecoderTests, WhenMissingParametersThenValidateInputReturnsErrorCode) {
|
||||
std::vector<std::string> args = {
|
||||
"ocloc",
|
||||
"decoder",
|
||||
"-patch",
|
||||
"test_files"};
|
||||
|
||||
MockDecoder decoder;
|
||||
EXPECT_NE(0, decoder.validateInput(args));
|
||||
}
|
||||
|
||||
TEST(DecoderTests, GivenWrongParametersWhenParsingParametersThenValidateInputReturnsErrorCode) {
|
||||
std::vector<std::string> args = {
|
||||
"cloc",
|
||||
"decoder",
|
||||
"-file",
|
||||
"test_files/no_extension",
|
||||
"-patch",
|
||||
"test_files",
|
||||
"-dump",
|
||||
"test_files/created"};
|
||||
|
||||
MockDecoder decoder;
|
||||
EXPECT_NE(0, decoder.validateInput(args));
|
||||
}
|
||||
|
||||
TEST(DecoderTests, GivenValidSizeStringWhenGettingSizeThenProperOutcomeIsExpectedAndExceptionIsNotThrown) {
|
||||
MockDecoder decoder;
|
||||
EXPECT_EQ(static_cast<uint8_t>(1), decoder.getSize("uint8_t"));
|
||||
@ -301,4 +277,28 @@ TEST(DecoderTests, GivenValidBinaryWhenProcessingBinaryThenProgramAndKernelAndPa
|
||||
EXPECT_TRUE(decoder.getMockIga()->disasmWasCalled);
|
||||
EXPECT_FALSE(decoder.getMockIga()->asmWasCalled);
|
||||
}
|
||||
|
||||
TEST(DecoderTests, givenNonPatchtokensBinaryFormatWhenTryingToGetDevBinaryFormatThenDoNotReturnRawData) {
|
||||
MockDecoder decoder;
|
||||
std::map<std::string, std::string> files;
|
||||
auto mockArgHelper = std::make_unique<MockOclocArgHelper>(files);
|
||||
decoder.argHelper = mockArgHelper.get();
|
||||
files["mockgen.gen"] = "NOTMAGIC\n\n\n\n\n\n\n";
|
||||
decoder.binaryFile = "mockgen.gen";
|
||||
auto data = decoder.getDevBinary();
|
||||
EXPECT_EQ(nullptr, data);
|
||||
}
|
||||
|
||||
TEST(DecoderTests, givenPatchtokensBinaryFormatWhenTryingToGetDevBinaryThenRawDataIsReturned) {
|
||||
MockDecoder decoder;
|
||||
std::map<std::string, std::string> files;
|
||||
auto mockArgHelper = std::make_unique<MockOclocArgHelper>(files);
|
||||
decoder.argHelper = mockArgHelper.get();
|
||||
size_t dataSize = 11u;
|
||||
files["mockgen.gen"] = "CTNI\n\n\n\n\n\n\n";
|
||||
decoder.binaryFile = "mockgen.gen";
|
||||
auto data = decoder.getDevBinary();
|
||||
std::string dataString(static_cast<const char *>(data), dataSize);
|
||||
EXPECT_STREQ("CTNI\n\n\n\n\n\n\n", dataString.c_str());
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -20,8 +20,10 @@ struct MockDecoder : public BinaryDecoder {
|
||||
argHelper = oclocArgHelperWithoutInput.get();
|
||||
argHelper->getPrinterRef() = MessagePrinter(true);
|
||||
};
|
||||
using BinaryDecoder::argHelper;
|
||||
using BinaryDecoder::binaryFile;
|
||||
using BinaryDecoder::decode;
|
||||
using BinaryDecoder::getDevBinary;
|
||||
using BinaryDecoder::getSize;
|
||||
using BinaryDecoder::iga;
|
||||
using BinaryDecoder::kernelHeader;
|
||||
|
Reference in New Issue
Block a user