mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
fix: fatbinary generation with "-out_dir"
Directories are created if needed before generating fatbinary. Related-To: NEO-11500 Signed-off-by: Oskar Hubert Weber <oskar.hubert.weber@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
aed96cede4
commit
a7ddf7848b
@@ -20,6 +20,7 @@
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
#include "igfxfmid.h"
|
||||
#include "platforms.h"
|
||||
@@ -424,14 +425,15 @@ int buildFatBinary(const std::vector<std::string> &args, OclocArgHelper *argHelp
|
||||
|
||||
std::string fatbinaryFileName = "";
|
||||
|
||||
if (false == outputDirectory.empty()) {
|
||||
if (!outputDirectory.empty()) {
|
||||
fatbinaryFileName = outputDirectory + "/";
|
||||
NEO::Directory::getDirectories(outputDirectory, NEO::Directory::createDirs);
|
||||
}
|
||||
|
||||
if (false == outputFileName.empty()) {
|
||||
if (!outputFileName.empty()) {
|
||||
fatbinaryFileName += outputFileName;
|
||||
} else {
|
||||
if (false == inputFileName.empty()) {
|
||||
if (!inputFileName.empty()) {
|
||||
fatbinaryFileName += OfflineCompiler::getFileNameTrunk(inputFileName) + ".ar";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <cinttypes>
|
||||
#include <optional>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -15,9 +16,33 @@ namespace NEO {
|
||||
|
||||
namespace Directory {
|
||||
extern bool returnEmptyFilesVector;
|
||||
inline constexpr char returnDirs = 1 << 0;
|
||||
inline constexpr char createDirs = 1 << 1;
|
||||
|
||||
std::vector<std::string> getFiles(const std::string &path);
|
||||
void createDirectory(const std::string &path);
|
||||
|
||||
inline std::optional<std::vector<std::string>> getDirectories(const std::string &path, char flags) {
|
||||
std::optional<std::vector<std::string>> directories;
|
||||
if (flags & returnDirs) {
|
||||
directories.emplace();
|
||||
}
|
||||
std::string tmp;
|
||||
size_t pos = 0;
|
||||
|
||||
while (pos != std::string::npos) {
|
||||
pos = path.find_first_of("/\\", pos + 1);
|
||||
tmp = path.substr(0, pos);
|
||||
if (flags & createDirs) {
|
||||
createDirectory(tmp);
|
||||
}
|
||||
if (flags & returnDirs) {
|
||||
directories->push_back(tmp);
|
||||
}
|
||||
}
|
||||
return directories;
|
||||
}
|
||||
|
||||
} // namespace Directory
|
||||
|
||||
inline int parseBdfString(const std::string &pciBDF, uint16_t &domain, uint8_t &bus, uint8_t &device, uint8_t &function) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -45,6 +45,7 @@ std::vector<std::string> getFiles(const std::string &path) {
|
||||
void createDirectory(const std::string &path) {
|
||||
const mode_t mode = 0777; // 777 in base 8
|
||||
[[maybe_unused]] auto status = mkdir(path.c_str(), mode);
|
||||
DEBUG_BREAK_IF(status != 0);
|
||||
DEBUG_BREAK_IF(status != 0 && errno != EEXIST);
|
||||
}
|
||||
|
||||
}; // namespace NEO::Directory
|
||||
|
||||
Reference in New Issue
Block a user