fix: generate SPIR-V for first device with -spv_only and multiple devices

If the family is provided as a device with the "-spv_only" flag, then
the SPIR-V file will be generated for the first device in the family.

Related-to: NEO-11550
Signed-off-by: Alicja Lukaszewicz <alicja.lukaszewicz@intel.com>
This commit is contained in:
Alicja Lukaszewicz
2024-06-27 14:44:13 +00:00
committed by Compute-Runtime-Automation
parent c5f0d3152d
commit 3db2bfc235
5 changed files with 125 additions and 2 deletions

View File

@@ -31,6 +31,11 @@
#include <set>
namespace NEO {
bool isSpvOnly(const std::vector<std::string> &args) {
return std::find(args.begin(), args.end(), "-spv_only") != args.end();
}
bool requestedFatBinary(ConstStringRef deviceArg, OclocArgHelper *helper) {
auto deviceName = deviceArg.str();
ProductConfigHelper::adjustDeviceName(deviceName);
@@ -266,6 +271,17 @@ std::vector<ConstStringRef> getTargetProductsForFatbinary(ConstStringRef deviceA
return retVal;
}
int getDeviceArgValueIdx(const std::vector<std::string> &args) {
for (size_t argIndex = 0; argIndex < args.size(); ++argIndex) {
const auto &currArg = args[argIndex];
const bool hasMoreArgs = (argIndex + 1 < args.size());
if ((ConstStringRef("-device") == currArg) && hasMoreArgs) {
return static_cast<int>(argIndex + 1);
}
}
return -1;
}
int buildFatBinaryForTarget(int retVal, const std::vector<std::string> &argsCopy, std::string pointerSize, Ar::ArEncoder &fatbinary,
OfflineCompiler *pCompiler, OclocArgHelper *argHelper, const std::string &product) {