PC Sampling: Allocate resources to retrieve data from trap handler

Allocate required device and host buffers to be able to interact with
the 2nd level trap handler.

Change-Id: If99de5aacf956ca57ecafc7b04b797be9c9decaa
This commit is contained in:
David Yat Sin
2023-08-17 15:04:58 +00:00
parent 431a70471e
commit 8d666dea01
3 changed files with 184 additions and 3 deletions
+12
View File
@@ -67,6 +67,7 @@ class Flag {
// Lift limit for 2.10 release RCCL workaround. This limit is not used when asynchronous scratch
// reclaim is supported
const size_t DEFAULT_SCRATCH_SINGLE_LIMIT = 146800640; // small_limit >> 2;
const size_t DEFAULT_PCS_MAX_DEVICE_BUFFER_SIZE = 256 * 1024 * 1024;
explicit Flag() { Refresh(); }
@@ -230,6 +231,13 @@ class Flag {
var = os::GetEnvVar("HSA_ENABLE_IPC_MODE_LEGACY");
enable_ipc_mode_legacy_ = (var == "1") ? true : false;
if (os::IsEnvVarSet("HSA_PCS_MAX_DEVICE_BUFFER_SIZE")) {
var = os::GetEnvVar("HSA_PCS_MAX_DEVICE_BUFFER_SIZE");
char* end;
pc_sampling_max_device_buffer_size_ = strtoul(var.c_str(), &end, 10);
} else {
pc_sampling_max_device_buffer_size_ = DEFAULT_PCS_MAX_DEVICE_BUFFER_SIZE;
}
// Temporary environment variable to disable CPU affinity override
// Will either rename to HSA_OVERRIDE_CPU_AFFINITY later or remove completely.
@@ -341,6 +349,8 @@ class Flag {
bool enable_ipc_mode_legacy() const { return enable_ipc_mode_legacy_; }
size_t pc_sampling_max_device_buffer_size() const { return pc_sampling_max_device_buffer_size_; }
private:
bool check_flat_scratch_;
bool enable_vm_fault_message_;
@@ -396,6 +406,8 @@ class Flag {
SRAMECC_ENABLE sramecc_enable_;
size_t pc_sampling_max_device_buffer_size_;
// Map GPU index post RVD to its default cu mask.
std::map<uint32_t, std::vector<uint32_t>> cu_mask_;