Merge commit '0d9428135c73bd8d14432f1d8cd64076f5ebfea2' into develop

Bu işleme şunda yer alıyor:
systems-assistant[bot]
2025-08-12 00:25:14 +00:00
işleme 2dc8e2f2d4
6 değiştirilmiş dosya ile 63 ekleme ve 260 silme
+1 -99
Dosyayı Görüntüle
@@ -1119,12 +1119,6 @@ bool IsCompatibleWithGenericTarget(const std::string& coTarget, const std::strin
std::vector<std::string> getLinkOptions(const LinkArguments& args) {
std::vector<std::string> res;
{ // process optimization level
std::string opt("-O");
opt += std::to_string(args.optimization_level_);
res.push_back(opt);
}
const auto irArgCount = args.linker_ir2isa_args_count_;
if (irArgCount > 0) {
res.reserve(irArgCount);
@@ -1257,103 +1251,11 @@ bool LinkProgram::isLinkerValid(LinkProgram* link_program) {
bool LinkProgram::AddLinkerOptions(unsigned int num_options, hipJitOption* options_ptr,
void** options_vals_ptr) {
for (size_t opt_idx = 0; opt_idx < num_options; ++opt_idx) {
if ( options_vals_ptr[opt_idx] == nullptr) {
if (options_vals_ptr[opt_idx] == nullptr) {
LogError("Options value can not be nullptr");
return false;
}
switch (options_ptr[opt_idx]) {
case hipJitOptionMaxRegisters:
link_args_.max_registers_ = *(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionThreadsPerBlock:
link_args_.threads_per_block_ =
*(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionWallTime:
link_args_.wall_time_ = *(reinterpret_cast<long*>(options_vals_ptr[opt_idx]));
break;
case hipJitOptionInfoLogBuffer: {
link_args_.info_log_ = (reinterpret_cast<char*>(options_vals_ptr[opt_idx]));
break;
}
case hipJitOptionInfoLogBufferSizeBytes:
link_args_.info_log_size_ = (reinterpret_cast<size_t>(options_vals_ptr[opt_idx]));
break;
case hipJitOptionErrorLogBuffer: {
link_args_.error_log_ = reinterpret_cast<char*>(options_vals_ptr[opt_idx]);
break;
}
case hipJitOptionErrorLogBufferSizeBytes:
link_args_.error_log_size_ = (reinterpret_cast<size_t>(options_vals_ptr[opt_idx]));
break;
case hipJitOptionOptimizationLevel:
link_args_.optimization_level_ =
*(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionTargetFromContext:
link_args_.target_from_hip_context_ =
*(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionTarget:
link_args_.jit_target_ = *(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionFallbackStrategy:
link_args_.fallback_strategy_ =
*(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionGenerateDebugInfo:
link_args_.generate_debug_info_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionLogVerbose:
link_args_.log_verbose_ = reinterpret_cast<size_t>(options_vals_ptr[opt_idx]);
break;
case hipJitOptionGenerateLineInfo:
link_args_.generate_line_info_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionCacheMode:
link_args_.cache_mode_ = *(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionSm3xOpt:
link_args_.sm3x_opt_ = *(reinterpret_cast<bool*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionFastCompile:
link_args_.fast_compile_ = *(reinterpret_cast<bool*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionGlobalSymbolNames: {
link_args_.global_symbol_names_ = reinterpret_cast<const char**>(options_vals_ptr[opt_idx]);
break;
}
case hipJitOptionGlobalSymbolAddresses: {
link_args_.global_symbol_addresses_ = reinterpret_cast<void**>(options_vals_ptr[opt_idx]);
break;
}
case hipJitOptionGlobalSymbolCount:
link_args_.global_symbol_count_ =
*(reinterpret_cast<unsigned int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionLto:
link_args_.lto_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionFtz:
link_args_.ftz_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionPrecDiv:
link_args_.prec_div_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionPrecSqrt:
link_args_.prec_sqrt_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionFma:
link_args_.fma_ = *(reinterpret_cast<int*>(&options_vals_ptr[opt_idx]));
break;
case hipJitOptionPositionIndependentCode:
link_args_.pic_ = *(reinterpret_cast<int *>(&options_vals_ptr[opt_idx]));
case hipJitOptionMinCTAPerSM:
link_args_.min_cta_per_sm_ = *(reinterpret_cast<int *>(&options_vals_ptr[opt_idx]));
case hipJitOptionMaxThreadsPerBlock:
link_args_.max_threads_per_block_ = *(reinterpret_cast<int *>(&options_vals_ptr[opt_idx]));
case hipJitOptionOverrideDirectiveValues:
link_args_.override_directive_values_ = *(reinterpret_cast<int *>(&options_vals_ptr[opt_idx]));
case hipJitOptionIRtoISAOptExt: {
link_args_.linker_ir2isa_args_ = reinterpret_cast<const char**>(options_vals_ptr[opt_idx]);
break;
+1 -61
Dosyayı Görüntüle
@@ -82,70 +82,10 @@ bool IsCompatibleWithGenericTarget(const std::string& coTarget, const std::strin
} // namespace helpers
struct LinkArguments {
unsigned int max_registers_;
unsigned int threads_per_block_;
float wall_time_;
size_t info_log_size_;
char* info_log_;
size_t error_log_size_;
char* error_log_;
unsigned int optimization_level_;
unsigned int target_from_hip_context_;
unsigned int jit_target_;
unsigned int fallback_strategy_;
int generate_debug_info_;
long log_verbose_;
int generate_line_info_;
unsigned int cache_mode_;
bool sm3x_opt_;
bool fast_compile_;
const char** global_symbol_names_;
void** global_symbol_addresses_;
unsigned int global_symbol_count_;
int lto_;
int ftz_;
int prec_div_;
int prec_sqrt_;
int fma_;
int pic_;
int min_cta_per_sm_;
int max_threads_per_block_;
int override_directive_values_;
const char** linker_ir2isa_args_;
size_t linker_ir2isa_args_count_;
LinkArguments()
: max_registers_{0},
threads_per_block_{0},
wall_time_{0.0f},
info_log_size_{0},
info_log_{nullptr},
error_log_size_{0},
error_log_{nullptr},
optimization_level_{3},
target_from_hip_context_{0},
jit_target_{0},
fallback_strategy_{0},
generate_debug_info_{0},
log_verbose_{0},
generate_line_info_{0},
cache_mode_{0},
sm3x_opt_{false},
fast_compile_{false},
global_symbol_names_{nullptr},
global_symbol_addresses_{nullptr},
global_symbol_count_{0},
lto_{0},
ftz_{0},
prec_div_{1},
prec_sqrt_{1},
fma_{1},
pic_{0},
min_cta_per_sm_{0},
max_threads_per_block_{0},
override_directive_values_{0},
linker_ir2isa_args_{nullptr},
linker_ir2isa_args_count_{0} {}
LinkArguments() : linker_ir2isa_args_{nullptr}, linker_ir2isa_args_count_{0} {}
};
class RTCProgram {
+14
Dosyayı Görüntüle
@@ -923,3 +923,17 @@ inline std::ostream& operator<<(std::ostream& os, const hipIpcEventHandle_t* s)
//TODO fill in later
return os;
}
inline std::ostream& operator<<(std::ostream& os, const hipPitchedPtr& p) {
os << "pitchPtr:" << std::hex << reinterpret_cast<uintptr_t>(p.ptr);
return os;
}
inline std::ostream& operator<<(std::ostream& os, const hipPitchedPtr* p) {
if (p) {
os << *p;
} else {
os << "nullptr";
}
return os;
}
-1
Dosyayı Görüntüle
@@ -25,7 +25,6 @@
#include "hip_prof_api.h"
#include "trace_helper.h"
#include "rocclr/utils/debug.hpp"
#include "hip_formatting.hpp"
#include "hip_graph_capture.hpp"
#include <unordered_set>
+41 -3
Dosyayı Görüntüle
@@ -1093,9 +1093,47 @@ hipError_t hipLinkCreate(unsigned int num_options, hipJitOption* options_ptr,
}
if (num_options != 0) {
for (int i = 0; i < num_options; i++) {
if (options_ptr == nullptr || options_vals_pptr == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
if (options_ptr == nullptr || options_vals_pptr == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
for (int i = 0; i < num_options; ++i) {
switch (options_ptr[i]) {
// CUDA only options
case hipJitOptionMaxRegisters:
case hipJitOptionThreadsPerBlock:
case hipJitOptionWallTime:
case hipJitOptionInfoLogBuffer:
case hipJitOptionInfoLogBufferSizeBytes:
case hipJitOptionErrorLogBuffer:
case hipJitOptionErrorLogBufferSizeBytes:
case hipJitOptionOptimizationLevel:
case hipJitOptionTargetFromContext:
case hipJitOptionTarget:
case hipJitOptionFallbackStrategy:
case hipJitOptionGenerateDebugInfo:
case hipJitOptionLogVerbose:
case hipJitOptionGenerateLineInfo:
case hipJitOptionCacheMode:
case hipJitOptionSm3xOpt:
case hipJitOptionFastCompile:
case hipJitOptionGlobalSymbolNames:
case hipJitOptionGlobalSymbolAddresses:
case hipJitOptionGlobalSymbolCount:
case hipJitOptionLto:
case hipJitOptionFtz:
case hipJitOptionPrecDiv:
case hipJitOptionPrecSqrt:
case hipJitOptionFma:
case hipJitOptionPositionIndependentCode:
case hipJitOptionMinCTAPerSM:
case hipJitOptionMaxThreadsPerBlock:
case hipJitOptionOverrideDirectiveValues:
case hipJitOptionNumOptions:
HIP_RETURN(hipErrorInvalidValue);
default:
// everything else is fine
break;
}
}
}
+6 -96
Dosyayı Görüntüle
@@ -20,10 +20,13 @@
#pragma once
#include "hip_formatting.hpp"
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
//---
// Helper functions to convert HIP function arguments into strings.
// Handles POD data types as well as enumerations (ie hipMemcpyKind).
@@ -109,6 +112,9 @@ inline std::string ToHexString(T v) {
return ss.str();
};
//---
// Template overloads for ToString to handle specific types
template <typename T>
inline std::string ToString(T* v) {
std::ostringstream ss;
@@ -131,9 +137,6 @@ inline std::string ToString(T** v) {
return ss.str();
};
//---
// Template overloads for ToString to handle specific types
// This is the default which works for most types:
template <typename T>
inline std::string ToString(T v) {
@@ -142,101 +145,9 @@ inline std::string ToString(T v) {
return ss.str();
};
template <>
inline std::string ToString(hipFunction_t v) {
std::ostringstream ss;
ss << "0x" << std::hex << static_cast<void*>(v);
return ss.str();
};
// hipEvent_t specialization. TODO - maybe add an event ID for debug?
template <>
inline std::string ToString(hipEvent_t v) {
std::ostringstream ss;
ss << "event:" << std::hex << static_cast<void*>(v);
return ss.str();
};
// hipStream_t
template <>
inline std::string ToString(hipStream_t v) {
std::ostringstream ss;
if (v == NULL) {
ss << "stream:<null>";
} else {
ss << "stream:" << std::hex << static_cast<void*>(v);
}
return ss.str();
};
// hipCtx_t
template <>
inline std::string ToString(hipCtx_t v) {
std::ostringstream ss;
if (v == NULL) {
ss << "context:<null>";
} else {
ss << "context:" << std::hex << static_cast<void*>(v);
}
return ss.str();
};
// hipPitchedPtr
template <>
inline std::string ToString(hipPitchedPtr v) {
std::ostringstream ss;
ss << "pitchPtr:" << std::hex << static_cast<void*>(v.ptr);
return ss.str();
};
// hipMemcpyKind specialization
template <>
inline std::string ToString(hipMemcpyKind v) {
switch (v) {
CASE_STR(hipMemcpyHostToHost);
CASE_STR(hipMemcpyHostToDevice);
CASE_STR(hipMemcpyDeviceToHost);
CASE_STR(hipMemcpyDeviceToDevice);
CASE_STR(hipMemcpyDefault);
CASE_STR(hipMemcpyDeviceToDeviceNoCU);
default:
return ToHexString(v);
};
};
template <>
inline std::string ToString(hipFuncCache_t v) {
switch (v) {
CASE_STR(hipFuncCachePreferNone);
CASE_STR(hipFuncCachePreferShared);
CASE_STR(hipFuncCachePreferL1);
CASE_STR(hipFuncCachePreferEqual);
default:
return ToHexString(v);
};
};
template <>
inline std::string ToString(hipSharedMemConfig v) {
switch (v) {
CASE_STR(hipSharedMemBankSizeDefault);
CASE_STR(hipSharedMemBankSizeFourByte);
CASE_STR(hipSharedMemBankSizeEightByte);
default:
return ToHexString(v);
};
};
template <>
inline std::string ToString(hipError_t v) {
return ihipErrorString(v);
};
// Catch empty arguments case
inline std::string ToString() { return (""); }
//---
// C++11 variadic template - peels off first argument, converts to string, and calls itself again to
// peel the next arg. Strings are automatically separated by comma+space.
@@ -245,7 +156,6 @@ inline std::string ToString(T first, Args... args) {
return ToString(first) + ", " + ToString(args...);
}
inline hipError_t ConvertCLErrorIntoHIPError(cl_int cl_error) {
hipError_t hip_error = hipSuccess;
switch (cl_error) {