mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Zebin manipulator - create dump directory fix
This commit fixes problem in zebin manipulator when dump was not created. * Explicitly create dump directory. * Add slash to dump argument. Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c7cb71e174
commit
0ef6b9b64c
@@ -122,7 +122,7 @@ if(WIN32)
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/os_inc.h
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/os_library_win.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/os_library_win.h
|
||||
${NEO_SOURCE_DIR}/shared/source/utilities/windows/directory.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/windows/directory.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND CLOC_LIB_SRCS_LIB
|
||||
@@ -131,8 +131,8 @@ else()
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/os_library_linux.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/os_library_linux.h
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/sys_calls_linux.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/linux/directory.cpp
|
||||
${OCLOC_DIRECTORY}/source/linux/os_library_ocloc_helper.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/utilities/linux/directory.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -14,19 +14,12 @@
|
||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define MakeDirectory _mkdir
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#define MakeDirectory(dir) mkdir(dir, 0777)
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
T readUnaligned(const void *ptr) {
|
||||
T retVal = 0;
|
||||
@@ -548,7 +541,7 @@ int BinaryDecoder::validateInput(const std::vector<std::string> &args) {
|
||||
argHelper->printf("Warning : Path to dump folder not specificed - using ./dump as default.\n");
|
||||
pathToDump = std::string("dump/");
|
||||
}
|
||||
MakeDirectory(pathToDump.c_str());
|
||||
NEO::Directory::createDirectory(pathToDump);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
#include "shared/source/device_binary_format/elf/zebin_elf.h"
|
||||
#include "shared/source/device_binary_format/zebin_decoder.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -104,6 +105,7 @@ bool is64BitZebin(OclocArgHelper *argHelper, const std::string §ionsInfoFile
|
||||
BinaryFormats getBinaryFormatForAssemble(OclocArgHelper *argHelper, const std::vector<std::string> &args) {
|
||||
auto it = std::find(args.begin(), args.end(), "-dump");
|
||||
std::string dump = (it != args.end() && (it + 1) != args.end()) ? *(it + 1) : "dump/";
|
||||
addSlash(dump);
|
||||
auto sectionsInfoFilepath = dump + ZebinManipulator::sectionsInfoFilename.str();
|
||||
const bool usesZebin = argHelper->fileExists(sectionsInfoFilepath);
|
||||
if (usesZebin) {
|
||||
@@ -167,6 +169,11 @@ ErrorCode ZebinDecoder<numBits>::decode() {
|
||||
}
|
||||
}
|
||||
|
||||
// Create dump directory if we are not using virtual filesystem
|
||||
if (false == argHelper->outputEnabled()) {
|
||||
Directory::createDirectory(arguments.pathToDump);
|
||||
}
|
||||
|
||||
auto sectionsInfo = dumpElfSections(elf);
|
||||
dumpSectionInfo(sectionsInfo);
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class Directory {
|
||||
public:
|
||||
static std::vector<std::string> getFiles(const std::string &path);
|
||||
};
|
||||
namespace Directory {
|
||||
std::vector<std::string> getFiles(const std::string &path);
|
||||
void createDirectory(const std::string &path);
|
||||
} // namespace Directory
|
||||
|
||||
inline int parseBdfString(const std::string &pciBDF, uint16_t &domain, uint8_t &bus, uint8_t &device, uint8_t &function) {
|
||||
if (strlen(pciBDF.c_str()) == 12) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace NEO {
|
||||
namespace NEO::Directory {
|
||||
|
||||
std::vector<std::string> Directory::getFiles(const std::string &path) {
|
||||
std::vector<std::string> getFiles(const std::string &path) {
|
||||
std::vector<std::string> files;
|
||||
|
||||
DIR *dir = opendir(path.c_str());
|
||||
@@ -37,4 +39,9 @@ std::vector<std::string> Directory::getFiles(const std::string &path) {
|
||||
closedir(dir);
|
||||
return files;
|
||||
}
|
||||
}; // namespace NEO
|
||||
|
||||
void createDirectory(const std::string &path) {
|
||||
const mode_t mode = 0777; // 777 in base 8
|
||||
mkdir(path.c_str(), mode);
|
||||
}
|
||||
}; // namespace NEO::Directory
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,9 +9,11 @@
|
||||
|
||||
#include "shared/source/os_interface/windows/windows_wrapper.h"
|
||||
|
||||
namespace NEO {
|
||||
#include <direct.h>
|
||||
|
||||
std::vector<std::string> Directory::getFiles(const std::string &path) {
|
||||
namespace NEO::Directory {
|
||||
|
||||
std::vector<std::string> getFiles(const std::string &path) {
|
||||
std::vector<std::string> files;
|
||||
std::string newPath;
|
||||
|
||||
@@ -37,4 +39,8 @@ std::vector<std::string> Directory::getFiles(const std::string &path) {
|
||||
FindClose(hFind);
|
||||
return files;
|
||||
}
|
||||
}; // namespace NEO
|
||||
|
||||
void createDirectory(const std::string &path) {
|
||||
_mkdir(path.c_str());
|
||||
}
|
||||
}; // namespace NEO::Directory
|
||||
|
||||
10
shared/test/common/libult/create_directory.cpp
Normal file
10
shared/test/common/libult/create_directory.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
void NEO::Directory::createDirectory(const std::string &path) {}
|
||||
Reference in New Issue
Block a user