libhsakmt: Enable invisible debug VRAM mappings by default
Remove the HSA_DEBUG environment variable that controlled the creation of these mappings. This should allow the debugger to attach to a running process and access VRAM buffers through ptrace without having to do anything special. On processes that create many small VRAM mappings, this may cause regressions due to the per-process mmap limit. However, the sub-allocator in ROCr should consolidate most small allocations into 2MB blocks nowadays, for good TLB efficiency. So this is unlikely to cause problems. Change-Id: I929da1be0f6cb51ec00a02f3f241d16083e4d95f Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
This commit is contained in:
@@ -221,7 +221,6 @@ static gpu_mem_t *gpu_mem;
|
||||
static unsigned int gpu_mem_count;
|
||||
static gpu_mem_t *g_first_gpu_mem;
|
||||
|
||||
static bool hsa_debug;
|
||||
static void *dgpu_shared_aperture_base;
|
||||
static void *dgpu_shared_aperture_limit;
|
||||
|
||||
@@ -1351,7 +1350,7 @@ void *fmm_allocate_device(uint32_t gpu_id, void *address, uint64_t MemorySizeInB
|
||||
pthread_mutex_unlock(&aperture->fmm_mutex);
|
||||
}
|
||||
|
||||
if (mem && (flags.ui32.HostAccess || hsa_debug)) {
|
||||
if (mem) {
|
||||
int map_fd = mmap_offset >= (1ULL<<40) ? kfd_fd :
|
||||
gpu_mem[gpu_mem_id].drm_render_fd;
|
||||
int prot = flags.ui32.HostAccess ? PROT_READ | PROT_WRITE :
|
||||
@@ -2055,15 +2054,11 @@ HSAKMT_STATUS fmm_init_process_apertures(unsigned int NumNodes)
|
||||
uint32_t num_of_sysfs_nodes;
|
||||
HSAKMT_STATUS ret = HSAKMT_STATUS_SUCCESS;
|
||||
char *disableCache, *pagedUserptr, *checkUserptr, *guardPagesStr, *reserveSvm;
|
||||
char *hsaDebug;
|
||||
unsigned int guardPages = 1;
|
||||
struct pci_access *pacc;
|
||||
uint64_t svm_base = 0, svm_limit = 0;
|
||||
uint32_t svm_alignment = 0;
|
||||
|
||||
hsaDebug = getenv("HSA_DEBUG");
|
||||
hsa_debug = hsaDebug && strcmp(hsaDebug, "0");
|
||||
|
||||
/* If HSA_DISABLE_CACHE is set to a non-0 value, disable caching */
|
||||
disableCache = getenv("HSA_DISABLE_CACHE");
|
||||
svm.disable_cache = (disableCache && strcmp(disableCache, "0"));
|
||||
|
||||
Reference in New Issue
Block a user