mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Generate Offline Dump Context ID
On linux OfflineDumpContextId consists of 32b processId in bits 63:32 32b drmContestId in bits 31:0 Also cache linux implementation of getProcessId since the value is constant. Related-To: NEO-7630 Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
53fe4de534
commit
fd971f7a61
@ -17,6 +17,7 @@
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/product_helper.h"
|
||||
#include "shared/source/os_interface/sys_calls_common.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@ -94,6 +95,16 @@ void OsContextLinux::waitForPagingFence() {
|
||||
|
||||
void OsContextLinux::reInitializeContext() {}
|
||||
|
||||
uint64_t OsContextLinux::getOfflineDumpContextId(uint32_t deviceIndex) const {
|
||||
if (deviceIndex < drmContextIds.size()) {
|
||||
const auto processId = SysCalls::getProcessId();
|
||||
const auto drmContextId = drmContextIds[deviceIndex];
|
||||
return static_cast<uint64_t>(processId) << 32 |
|
||||
static_cast<uint64_t>(drmContextId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
OsContextLinux::~OsContextLinux() {
|
||||
if (contextInitialized) {
|
||||
for (auto drmContextId : drmContextIds) {
|
||||
|
@ -50,6 +50,8 @@ class OsContextLinux : public OsContext {
|
||||
return contextHangDetected;
|
||||
}
|
||||
|
||||
uint64_t getOfflineDumpContextId(uint32_t deviceIndex) const override;
|
||||
|
||||
protected:
|
||||
bool initializeContext() override;
|
||||
|
||||
|
@ -22,7 +22,8 @@ namespace NEO {
|
||||
namespace SysCalls {
|
||||
|
||||
unsigned int getProcessId() {
|
||||
return getpid();
|
||||
static unsigned int pid = getpid();
|
||||
return pid;
|
||||
}
|
||||
|
||||
unsigned long getNumThreads() {
|
||||
|
Reference in New Issue
Block a user