Build native Windows packages for both RDNA4 targets
Add explicit gfx1200/gfx1201 builds, runtime selection and per-target code objects. Guard staging, packaging and installation against mixed architectures; retain gfx1201 compatibility and strict K/M arithmetic. Adapt realdody's target configuration and MSVC binary16/BOOL portability fixes from ae530b0. Do not import its forced gfx12 layout on RDNA3. Add exhaustive binary16 and C++/PowerShell target contract regressions. Validation: 20 CTest gates on RX 9070 XT; four software-only gfx1200 gates; MSVC portability compile checks; exact 4K K async and M control outputs; isolated package install/restore and mixed-target rejection tests. No physical gfx1200 validation is claimed. Co-authored-by: realdody <[email protected]>
This commit is contained in:
1 parent
8f7058d2ba
commit
98de8e3a3e
51 files changed
+636
-127
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#ifndef D4R_TARGET_ARCH
|
||||
#define D4R_TARGET_ARCH "gfx1201"
|
||||
#endif
|
||||
|
||||
namespace d4r::diag {
|
||||
inline bool supported_gpu_target(const std::string& target) {
|
||||
return target == "gfx1200" || target == "gfx1201";
|
||||
}
|
||||
inline std::string gpu_architecture(const std::string& name) {
|
||||
return name.substr(0, name.find(':'));
|
||||
}
|
||||
inline void require_gpu_target(const std::string& actual, const std::string& expected) {
|
||||
if (!supported_gpu_target(expected) || gpu_architecture(actual) != expected)
|
||||
throw std::runtime_error("GPU architecture mismatch: detected " + actual + ", package requires " + expected);
|
||||
}
|
||||
inline std::string code_object_target(const std::filesystem::path& path) {
|
||||
// AMDGPU ELF e_flags machine IDs from LLVM's documented code-object ABI.
|
||||
// Never infer compatibility from a filename or rewrite the ELF target.
|
||||
std::ifstream file(path, std::ios::binary);
|
||||
std::array<unsigned char, 64> header{};
|
||||
if (!file.read(reinterpret_cast<char*>(header.data()), header.size()) ||
|
||||
header[0] != 0x7f || header[1] != 'E' || header[2] != 'L' || header[3] != 'F' ||
|
||||
header[4] != 2 || header[5] != 1 || header[18] != 0xe0 || header[19] != 0)
|
||||
throw std::runtime_error("Invalid AMDGPU ELF64 code object: " + path.string());
|
||||
switch (header[48]) {
|
||||
case 0x48: return "gfx1200";
|
||||
case 0x4e: return "gfx1201";
|
||||
default: throw std::runtime_error("Unsupported AMDGPU code-object target: " + path.string());
|
||||
}
|
||||
}
|
||||
inline void require_code_object_target(const std::filesystem::path& path, const std::string& expected) {
|
||||
require_gpu_target(code_object_target(path), expected);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user