Add APIs to support debugging vm fault
1. Add hsa ext api hsa_amd_register_vmfault_handler for debugger to register callback in case of VM fault.
2. Extend hsa_ven_amd_loader API to:
(1) iterate loaded code objects in executable:
hsa_ven_amd_loader_executable_iterate_loaded_code_objects
(2) get loaded code object info:
hsa_ven_amd_loader_loaded_code_object_get_info
3. Make the id of hsa_queue the same as the one used in communication with thunk (for amd_aql_queue)
Change-Id: I68910809e59e24297350d262606f00e96c14bcbd
Bu işleme şunda yer alıyor:
@@ -208,6 +208,15 @@ public:
|
||||
void *data),
|
||||
void *data) = 0;
|
||||
|
||||
virtual hsa_agent_t getAgent() const = 0;
|
||||
virtual hsa_executable_t getExecutable() const = 0;
|
||||
virtual uint64_t getElfData() const = 0;
|
||||
virtual uint64_t getElfSize() const = 0;
|
||||
virtual uint64_t getStorageOffset() const = 0;
|
||||
virtual uint64_t getLoadBase() const = 0;
|
||||
virtual uint64_t getLoadSize() const = 0;
|
||||
virtual int64_t getDelta() const = 0;
|
||||
|
||||
protected:
|
||||
LoadedCodeObject() {}
|
||||
|
||||
@@ -329,6 +338,7 @@ public:
|
||||
|
||||
virtual hsa_status_t IterateLoadedCodeObjects(
|
||||
hsa_status_t (*callback)(
|
||||
hsa_executable_t executable,
|
||||
hsa_loaded_code_object_t loaded_code_object,
|
||||
void *data),
|
||||
void *data) = 0;
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
//
|
||||
// The University of Illinois/NCSA
|
||||
// Open Source License (NCSA)
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2014-2015, Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
//
|
||||
// Developed by:
|
||||
//
|
||||
//
|
||||
// AMD Research and AMD HSA Software Development
|
||||
//
|
||||
//
|
||||
// Advanced Micro Devices, Inc.
|
||||
//
|
||||
//
|
||||
// www.amd.com
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal with the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimers.
|
||||
// - Redistributions in binary form must reproduce the above copyright
|
||||
@@ -29,7 +29,7 @@
|
||||
// nor the names of its contributors may be used to endorse or promote
|
||||
// products derived from this Software without specific prior written
|
||||
// permission.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
@@ -164,6 +164,10 @@ class HostQueue : public Queue {
|
||||
bool active_;
|
||||
void* ring_;
|
||||
|
||||
// Host queue id counter, starting from 0x80000000 to avoid overlaping
|
||||
// with aql queue id.
|
||||
static volatile uint32_t queue_count_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(HostQueue);
|
||||
};
|
||||
} // namespace core
|
||||
|
||||
@@ -174,13 +174,13 @@ hsa_status_t HSA_API
|
||||
hsa_amd_memory_fill(void* ptr, uint32_t value, size_t count);
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t HSA_API hsa_amd_interop_map_buffer(uint32_t num_agents,
|
||||
hsa_agent_t* agents,
|
||||
int interop_handle,
|
||||
uint32_t flags,
|
||||
size_t* size,
|
||||
void** ptr,
|
||||
size_t* metadata_size,
|
||||
hsa_status_t HSA_API hsa_amd_interop_map_buffer(uint32_t num_agents,
|
||||
hsa_agent_t* agents,
|
||||
int interop_handle,
|
||||
uint32_t flags,
|
||||
size_t* size,
|
||||
void** ptr,
|
||||
size_t* metadata_size,
|
||||
const void** metadata);
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
@@ -210,6 +210,12 @@ hsa_status_t hsa_amd_ipc_signal_create(hsa_signal_t signal, hsa_amd_ipc_signal_t
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t hsa_amd_ipc_signal_attach(const hsa_amd_ipc_signal_t* handle, hsa_signal_t* signal);
|
||||
|
||||
// Mirrors Amd Extension Apis
|
||||
hsa_status_t hsa_amd_register_system_event_handler(
|
||||
hsa_amd_event_t type,
|
||||
hsa_status_t (*callback)(const void* event_specific_data, void* data),
|
||||
void* data);
|
||||
|
||||
} // end of AMD namespace
|
||||
|
||||
#endif // header guard
|
||||
|
||||
@@ -317,6 +317,8 @@ class Runtime {
|
||||
|
||||
ExtensionEntryPoints extensions_;
|
||||
|
||||
hsa_status_t SetCustomVMFaultHandler(hsa_status_t (*callback)(const void* event_specific_data, void* data), void* data);
|
||||
|
||||
protected:
|
||||
static void AsyncEventsLoop(void*);
|
||||
|
||||
@@ -479,9 +481,6 @@ class Runtime {
|
||||
|
||||
AsyncEvents new_async_events_;
|
||||
|
||||
// Queue id counter.
|
||||
uint32_t queue_count_;
|
||||
|
||||
// Starting address of SVM address space.
|
||||
// On APU the cpu and gpu could access the area inside starting and end of
|
||||
// the SVM address space.
|
||||
@@ -502,6 +501,11 @@ class Runtime {
|
||||
// @brief HSA signal to contain the VM fault event.
|
||||
Signal* vm_fault_signal_;
|
||||
|
||||
// custom VM fault handler.
|
||||
hsa_status_t (*vm_fault_handler_custom_)(const void* event_specific_data,
|
||||
void* data);
|
||||
void* vm_fault_handler_user_data_;
|
||||
|
||||
// Holds reference count to runtime object.
|
||||
volatile uint32_t ref_count_;
|
||||
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle