Grafik Komit

143 Melakukan

Penulis SHA1 Pesan Tanggal
Felix Kuehling caf8b70da7 libhsakmt: Implement dmabuf export for RDMA
Implement hsaKmtExportDMABufHandle, which can be used for a new
upstreamable RDMA solution. It exports a DMABuf handle for an arbitrary
virtual address along with the offset of the address within the
allocation. It also checks that the size of the intended export does
not exceed the allocation.

This uses the new AMDKFD_IOC_EXPORT_DMABUF, which requires KFD ioctl
API version 1.12.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Change-Id: Ie5fdb1f73ab3c7fa36c315ce326b1fb89eacc8b6


[ROCm/ROCR-Runtime commit: 332f59eb2a]
2023-02-27 14:44:11 -05:00
Lang Yu 9c16ddc3b2 libhsakmt: add FamilyID info into HsaNodeProperties
Query family id info from drm render node, then
ROCr can query this info directly from Thunk
instead of parsing the info by itself.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Change-Id: I030bd27ab2379fbf87f3d787302c3b8613456278


[ROCm/ROCR-Runtime commit: 66e9e97e0d]
2022-08-24 21:14:06 -04:00
Eric Huang 1d5b141016 libhsakmt: allocate unified memory for ctx save restore area
To improve performance on queue preemption, allocate ctx s/r
 area in VRAM instead of system memory, and migrate it back
 to system memory when VRAM is full.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Change-Id: If775782027188dbe84b6868260e429373675434c


[ROCm/ROCR-Runtime commit: 37be876cad]
2022-07-11 18:06:55 -04:00
Eric Huang 3c6cc14728 libhsakmt: add new flag for svm
It is to add new option for always keeping gpu mapping
and bump KFD version for the feature of unified save
restore memory.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Change-Id: Iebee35e6de4d52fa29f82dd19f6bbf5640249492


[ROCm/ROCR-Runtime commit: e1d1a6fbb0]
2022-07-11 18:06:48 -04:00
Philip Yang be429e8651 libhsakmt: add open SMI event handle
System Management Interface event is read from anonymous file handle,
this helper wrap the ioctl interface to get anonymous file handle for
GPU nodeid.

Define SMI event IDs, event triggers, copy the same value from
kfd_ioctl.h to avoid translation.

Change-Id: I5c8ba5301473bb3b80bb4e2aa33a9f675bedb001
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: 405fbd6f93]
2022-06-20 08:49:13 -04:00
Philip Yang 890410d9cd libhsakmt: hsaKmtGetNodeProperties add gpu_id
Add KFDGpuID to HsaNodeProperties to return gpu_id to upper layer,
gpu_id is hash ID generated by KFD to distinguish GPUs on the system.
ROCr and ROCProfiler will use gpu_id to analyze SMI event message.

Change-Id: I6eabe6849230e04120674f5bc55e6ea254a532d6
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: 88778e13dc]
2022-06-20 08:48:44 -04:00
Daniel Phillips 8a60a6037e libhsakmt: Add support for hsaKmtAvailableMemory
New API function to report available memory per GPU

Signed-off-by: Daniel Phillips <Daniel.Phillips@amd.com>
Change-Id: I63c1e4ca0020c657977ab3635947ab0ed0a81440


[ROCm/ROCR-Runtime commit: 6da6058d4a]
2022-06-13 09:37:32 -04:00
Felix Kuehling 8fc6558236 libhsakmt: Update kfd_ioctl.h
Import the latest version from the kernel tree.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Change-Id: If5f998ad55085ebd5020adaa382181204d834e3e


[ROCm/ROCR-Runtime commit: f88aaa933b]
2022-03-21 14:41:18 -04:00
Philip Cox eef3f372f2 libhsakmt: Add more debug information
We need to add some more information about the debug features supported
by the platform.  We are adding the following:
        - debug supported
        - dispatch info always valid
        - precise memop supported
        - watchpoints shared

Change-Id: I68deed98619396d17e28c6e18bad424b58297485
Signed-off-by: Philip Cox <Philip.Cox@amd.com>


[ROCm/ROCR-Runtime commit: 489db9fac6]
2021-10-22 13:49:34 -04:00
Philip Yang 41b4ff5170 libhsakmt: update query pointer info document
Query pointer info return HsaPointerInfo with MemFlags for all pointer
type now.



Change-Id: I3c02b7b71ba0af953035e3ed9cd6bb6435bb9b65
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: 991cde0656]
2021-07-29 21:10:38 -04:00
Philip Yang 6a15d17257 libhsakmt: update to KFD ioctl version 1.6
sync with KFD ioctl version 1.6:

1.6 - Query clear flags in SVM get_attr API

Change import export handle args pad field to flags, to pass memory
alloc flags from alloc process to import process.

Change-Id: I69360b244651947e885c4a8da9f64a1163101d20
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: dee9c023a2]
2021-07-21 21:48:18 -04:00
Kent Russell 77588e8159 Fix drm.h include path
kernel-headers provides the drm/drm.h path, while libdrm-dev[el]
provides the libdrm/drm.h path, which is what we want to use. Fix the
path so we use the newer drm.h header, as well as fixing SLES, which
doesn't provide drm.h in their kernel-headers.

Change-Id: Icb2b6643698d356169e3baeef17527a1b4e05483


[ROCm/ROCR-Runtime commit: 4f3440a8ac]
2021-07-20 12:49:15 -04:00
Jonathan Kim 6c4717ae7a libhsakmt: add runtime enable and disable calls
Add hsaKmtRuntimeEnable and disable.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Change-Id: I083f9293948e975546a1b3c1334cb41499b9ab1f


[ROCm/ROCR-Runtime commit: 1ce548829b]
2021-07-16 18:37:41 -04:00
Jonathan Kim 1001f27cb5 libhsakmt: update thunk api for exception handling
The debugger and debug agent no longer use the Thunk API.
Remove all deprecated functions and keep commented
references for future KFD tests.

Update and the keep the version checks for future use
and hsaKmtRuntimeEnable/Disable.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Laurent Morichetti <laurent.morichetti@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Change-Id: Ia2f10d82f5ac36d0bd1bda233810f26e8a154d55


[ROCm/ROCR-Runtime commit: 31ac82617c]
2021-07-16 18:36:18 -04:00
Jonathan Kim fe03b35c8e libhsakmt: update create queue for exception handling
Update hsaKmtCreateQueue to initialize the new save area header with the
exception payload and event ID.

Signed-by-off: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Sean Keely <sean.keely@amd.com>
Change-Id: Icd38062dc982cb29b30644699014eeb0b3e26d00


[ROCm/ROCR-Runtime commit: 96c7a5c9dc]
2021-07-16 18:34:35 -04:00
Alex Sierra 221f75ea7a libhsakmt: move CoherentHostAccess prop to HSA_CAPABILITY
CoherentHostAccess flag member moved from HSA_MEMORYPROPERTY
to HSA_CAPABILITY struct. Now this is reported to the
topology as a capability of the device instead of a device
memory property.

Change-Id: I48e43e4b4a0635b711b62933734587facdfbf88b
Signed-off-by: Alex Sierra <alex.sierra@amd.com>


[ROCm/ROCR-Runtime commit: f85b428265]
2021-06-10 22:21:17 -05:00
Mike Li a8ceb5c406 Add Size of VGPR and SGPR to HsaNodeProperties
Signed-off-by: Mike Li <Tianxinmike.Li@amd.com>
Change-Id: I7e6c0c5b9fd90c0bb5f3b7d35362a073afdcf9b8


[ROCm/ROCR-Runtime commit: 47ccc6604d]
2021-05-03 15:16:15 -04:00
Philip Yang 4d16b1158f libhsakmt: dynamic HMM and xnack detection
New properties SVMAPISupported added in Thunk spec HSA_CAPABILITY, read
from sysfs from KFD topology.

New local memory property flag CoherentHostAccess added to Thunk
HSA_MEMORYPROPERTY, read from sysfs from KFD topology.

Change-Id: I83933f0e5a61508508168873209dba4af0b77295
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: e8f369b385]
2021-04-16 00:10:56 -04:00
Felix Kuehling 71edb8509e libhsakmt: add API to support svm and xnack
Add function definitions to support SVM (shared virtual memory)
and xnack set.

Change-Id: Ia97ad9d0c449d8d500d799f702e1a58e87d65a56
Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>


[ROCm/ROCR-Runtime commit: c44a4be776]
2021-04-16 00:09:49 -04:00
Felix Kuehling ace48bdb53 libhsakmt: add kfd_ioctl.h svm and xnack support
Add svm (shared virtual memory) range and xnack mode
APIs.

Change-Id: Ibd8d7fe566dc200730da0c892caa71aad7589ebd
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Sierra <alex.sierra@amd.com>


[ROCm/ROCR-Runtime commit: ce26348f3a]
2021-04-16 00:09:17 -04:00
Felix Kuehling 4493f63d55 libhsakmt: New SRAM EDC support bit
The old bit was deprecated, because old buggy user mode depends on it
being always 0. The correct value is now reported in a new bit. New user
mode handles the reported EDC setting correctly, so we can report the
correct value in a new bit.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Change-Id: Ib5d5ed2519810e650458c6b69c97670dab435ddb


[ROCm/ROCR-Runtime commit: d287c60246]
2021-03-11 13:37:45 -05:00
Felix Kuehling 3be7292742 Revert "libhsakmt: add kfd_ioctl.h svm and xnack support"
This reverts commit 07b0758bee.
SVM is not ready yet. This was merged by accident.

Change-Id: I8901594a72e785ba5d25a6448718a570e76fe117
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>


[ROCm/ROCR-Runtime commit: 41cd7aea2f]
2021-03-10 22:33:49 -05:00
Felix Kuehling cb956dc239 Revert "libhsakmt: add API to support svm and xnack"
This reverts commit 08e65a397a.
SVM is not ready yet. This was merged by accident.

Change-Id: I1bee102823e7e612be8e8f2e0f50580e8692cc80
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>


[ROCm/ROCR-Runtime commit: 5edd00136d]
2021-03-10 22:33:49 -05:00
Kent Russell 3a90583c47 Merge gfx90a into amd-staging
Conflicts:
	CMakeLists.txt
	include/hsakmt.h
	src/libhsakmt.h
	src/libhsakmt.ver
	src/queues.c
	src/topology.c
	tests/kfdtest/src/KFDMemoryTest.cpp
	tests/kfdtest/src/KFDTestUtil.hpp

Signed-off-by: Kent Russell <kent.russell@amd.com>
Change-Id: Ic2732e7c0b5e42c1a3a91223f65a65064b602181


[ROCm/ROCR-Runtime commit: 83d80074f7]
2021-03-02 07:48:22 -05:00
Laurent Morichetti c3940a1d44 Update the context save area size
Reserve some space in the context save area for the debugger's
use. There should be 32 bytes per wave for a given queue.

Change-Id: I65ddb6123d0f6afd3149844617ad19023009101d


[ROCm/ROCR-Runtime commit: a83f9b67ce]
2021-02-23 12:20:29 -05:00
Alex Sierra 08e65a397a libhsakmt: add API to support svm and xnack
Add function definitions to support SVM (shared virtual memory)
and xnack set.

Change-Id: Ia97ad9d0c449d8d500d799f702e1a58e87d65a56
Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>


[ROCm/ROCR-Runtime commit: a352639df5]
2021-02-23 12:20:29 -05:00
Philip Yang 07b0758bee libhsakmt: add kfd_ioctl.h svm and xnack support
Add svm (shared virtual memory) range and xnack mode
APIs.

Change-Id: Ibd8d7fe566dc200730da0c892caa71aad7589ebd
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Sierra <alex.sierra@amd.com>


[ROCm/ROCR-Runtime commit: 5ae49f2321]
2021-02-23 12:20:29 -05:00
Jonathan Kim 480618489e libhsakmt: add host trap send
Adding host trap send command.

Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Change-Id: I291c13f5905e00bc6685a980284a6abd0c98da78


[ROCm/ROCR-Runtime commit: f398d6d204]
2021-02-23 12:20:29 -05:00
Eric Huang 9f7ae5b9e2 libhsakmt: add new flag for memory mapped as uncached
It is to provide an option to map specific memory as
uncached on A+A HW platform.

Signed-off-by: Eric Huang <JinhuiEric.Huang@amd.com>
Change-Id: Ib665cb306a0e78aba3ea5ee2f0e46cb62ae139f8


[ROCm/ROCR-Runtime commit: 2464bfc714]
2021-02-23 12:20:29 -05:00
Gang Ba 0ddd455ead libhsakmt: add Streaming Performance Monitors APIs
Signed-off-by: Gang Ba <gaba@amd.com>
Change-Id: Iab9a98fa2079b7cae7158c524479dfc3fa672407


[ROCm/ROCR-Runtime commit: e8c0426c54]
2020-11-16 16:36:21 -05:00
Laurent Morichetti 18240aa6d6 Update the context save area size
Reserve some space in the context save area for the debugger's
use. There should be 32 bytes per wave for a given queue.

Change-Id: I65ddb6123d0f6afd3149844617ad19023009101d


[ROCm/ROCR-Runtime commit: 2ed2e46b9b]
2020-10-05 12:10:58 -07:00
Ramesh Errabolu df461e1efa Fix typo in the field name Mem_EDCSupport of HSA_CAPABILITY entity
Change-Id: Ic1aba0b2c6e7bc8324fe756df84998f32a8c09da


[ROCm/ROCR-Runtime commit: b0b0a1b479]
2020-07-09 12:42:30 -04:00
Gang Ba 04e57413f4 Revert "libhsakmt: add Streaming Performance Monitors APIs"
This reverts commit c0a0ada18b.

Reason for revert: Change was submitted by accident

Change-Id: If05c705e22296fd3ca789f269737d379a933361d
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>


[ROCm/ROCR-Runtime commit: fec3780c1a]
2020-06-29 10:54:54 -04:00
Gang Ba c0a0ada18b libhsakmt: add Streaming Performance Monitors APIs
Signed-off-by: Gang Ba <gaba@amd.com>
Change-Id: I5c23a8dacf9bc50c740908aabe391432f2c7112e
Signed-off-by: Gang Ba <gaba@amd.com>


[ROCm/ROCR-Runtime commit: d675d1cce1]
2020-05-29 09:34:31 -04:00
Joseph Greathouse efe478aed6 Pull out ASIC revision from HSA capability
KFD now passes the ASIC revision to user level through some bits
in the HSA topology's capability field. Some user-level software
wants this because different ASIC revisions may require user-level
software to do different things (e.g. patch code for things that
are changed in later hardware revisions).

Change-Id: I16f2a15ae0875edd01ebdb1f1685ec7865f7049e


[ROCm/ROCR-Runtime commit: 5ddd8fb68b]
2020-05-22 10:39:13 -05:00
Philip.Cox@amd.com fc181bcdb1 Initial kfd debugger address watch support
Code for new kfd debugger address watch code.
           -- Adding support for:
              -- add address watch
              -- clear address watch

Change-Id: I9b014e7cee03897157b997b9e5b39b6ed403b8e1
Signed-off-by: Philip.Cox@amd.com <Philip.Cox@amd.com>


[ROCm/ROCR-Runtime commit: 0a55f31463]
2020-05-21 13:41:55 -04:00
Amber Lin 2aa89d8bf4 libhsakmt: Sync up the ioctl number
Update the non-upstream ioctl numbers to align with the change in the
kernel.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Change-Id: Ie0ddccb343a023b55eb18477c59341acaa666e99


[ROCm/ROCR-Runtime commit: a37a88ddcb]
2020-05-12 15:06:07 -04:00
Divya Shikre b54a23f31a libhsakmt: Expose device Unique Id
Read device unique id from sysfs and expose it in HsaNodeProperties.
For devices not supported the value will be 0

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I97b8689dfa090971c6876de6feaa97652e28c03d


[ROCm/ROCR-Runtime commit: ebe7de1f99]
2020-03-10 10:06:11 -05:00
Sean Keely 619acf4f75 Update pointer info to include IPC memory.
IPC memory was previously returned as HSA_POINTER_ALLOCATED and
had garbage in the node_id field.  Due to ROCR_VISIBLE_DEVICES
we need to be able to distinguish between imported memory and
regular memory because imported memory may not be owned by an
agent that is visible in the process.  Differentiating these flags
allows the users to expect null agent for the owning agent.

Fixes 

Change-Id: Ide3489cec1ee2072dc9697fa5cb71ddb17999d14


[ROCm/ROCR-Runtime commit: 6957202df8]
2020-02-05 01:55:39 -06:00
Huang Rui cc2162d8e9 libhsakmt: add NumCpQueues and NumSdmaQueuesPerEngine data field (v3)
NumCpQueues and NumSdmaQueuesPerEngine should be got by kfd driver not hardcode.
So add two data fields in HsaNodeProperties then thunk is able to get it from sysfs
that exposed by kfd.

v2: change NumCpQueues/NumSdmaQueuesPerEngine to one byte.
v3: merge two commits as one to avoid ABI update two times.

Change-Id: Ie386e4685f13493e22db6e207a399db6a4c5b9dc
Signed-off-by: Huang Rui <ray.huang@amd.com>


[ROCm/ROCR-Runtime commit: 06464b917d]
2020-01-03 23:27:42 -05:00
Jonathan Kim efef21f4ff add queue snapshot test
adds api and test to get newly create queue snapshot per ptraced process.

Change-Id: Ife97123a5b930e837ccaa386801145ef23c2cc2c
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>


[ROCm/ROCR-Runtime commit: 8b01a1c4c5]
2019-12-02 11:56:04 -05:00
Philip Cox 74fe695127 Remove debugger data reg accesses
The debug trap accesses the data0/data1 registers, so we do not
want the userspace to write values to it.  We remove the calls to
set the data0/data1 register values.

Change-Id: Iaba842a4c445f339f16a39fe1994526ff78a2f3c
Signed-off-by: Philip Cox <Philip.Cox@amd.com>


[ROCm/ROCR-Runtime commit: 6933540c81]
2019-10-10 14:32:54 -04:00
Philip Cox 4c3e49f243 Add functions to get the kfd debugger version info
To support adding new features to the kfd debugger, and not break
functionality, we need to be able to check the kfd debugger support
version info from the kernel.

Change-Id: Icd88e4edab8430c35eaed588e62d892c1b5c62ec
Signed-off-by: Philip Cox <Philip.Cox@amd.com>


[ROCm/ROCR-Runtime commit: dbbd189b33]
2019-10-10 14:32:54 -04:00
Philip Cox 7c81389f01 Add kfd debugger version support
To check the KFD debugger API support, we need to be able to check
the major/minor version of the kfd debugger version, so we need to
expose this function from the kernel.

Change-Id: I8a3dc617607e2efa9e65306d08b8583b8b1a2172
Signed-off-by: Philip Cox <Philip.Cox@amd.com>


[ROCm/ROCR-Runtime commit: 35d56297d3]
2019-10-10 14:32:54 -04:00
Philip Yang 92dd1072a0 libhsakmt: handle NUMA system with no memory on node 0
on NUMA system, node 0 may have no memory, application pass node id
0 to hsaKmtAllocMemory will fail because mbind to specify the allocation
from node 0 return EINVAL.

Add new flag NoNUMABind for application to pass it to hsaKmtAllocMemory
to skip mbind.

hsaKmtCreateEvent and hsaKmtCreateQueue specify the new flag NoNUMABind
to allocate system memory for event page and CWSR area, don't bind the
system memory to a specific NUMA node.

Change-Id: I854e5a57502c7807c4c5ff2e441d499ae515c309
Signed-off-by: Philip Yang <Philip.Yang@amd.com>


[ROCm/ROCR-Runtime commit: 42392f093f]
2019-09-16 11:30:24 -04:00
Ori Messinger 9eb9ce78fa Report domain with HsaNodeProperties
PCI domain has moved to 32-bits to accommodate virtualization,
so a 32-bit integer is exposed for domain to reflect this change.

Change-Id: I0d767acadcdc8e4277db203b5865dd67dd001cef
Signed-off-by: Ori Messinger <ori.messinger@amd.com>


[ROCm/ROCR-Runtime commit: f2173254e4]
2019-08-23 11:59:19 -04:00
Jonathan Kim c9cc529a4f add new queue bit test on clear event
enable thunk query api to report if queue is newly created
test new queue bit test on clear events.
also fixup cleanup to disable debug trap.

Change-Id: I3ebe2d85da66f28b8c82f0e68461ee7d32ec0b0d
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>
Reviewed-by: Philip Cox <Philip.Cox@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


[ROCm/ROCR-Runtime commit: 1ff5cb33b2]
2019-08-23 11:25:32 -04:00
Jonathan Kim 8fc23418ea libhsakmt: update dbg enable trap and add query debug events
Add data out for enable trap to return poll fd to user space.
Add query debug events interface.

Change-Id: Ia4afde1cf167e6aa61d502380a8b329ee89d5f44
Signed-off-by: Jonathan Kim <Jonathan.Kim@amd.com>


[ROCm/ROCR-Runtime commit: 836dfd0752]
2019-08-07 10:04:33 -04:00
Oak Zeng dc22f0c67e Remove NodeId parameter from hsaKmtAllocQueueGWS
The NodeId parameter is redundant and can be retrieved
from QueueId parameter.

Change-Id: I12853849b868b304bd27633fa7653ba644d69026
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>


[ROCm/ROCR-Runtime commit: f40f166e20]
2019-08-06 20:20:30 -04:00
Oak Zeng ef47fe0e1e Thunk API to allocate queue GWS
Change-Id: I6c5b109e2567cb71aed9245923cfcbeee6295ab2
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>


[ROCm/ROCR-Runtime commit: 65d554f5e4]
2019-06-10 21:07:45 -05:00