gem5  v21.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gpu_compute_driver.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
35 
36 #include "cpu/thread_context.hh"
37 #include "debug/GPUDriver.hh"
38 #include "dev/hsa/hsa_device.hh"
41 #include "dev/hsa/kfd_ioctl.h"
42 #include "params/GPUComputeDriver.hh"
43 #include "sim/syscall_emul_buf.hh"
44 
46  : HSADriver(p)
47 {
48  device->attachDriver(this);
49  DPRINTF(GPUDriver, "Constructing KFD: device\n");
50 }
51 
52 int
53 GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
54 {
55  auto &virt_proxy = tc->getVirtProxy();
56 
57  switch (req) {
59  {
60  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_GET_VERSION\n");
61 
65 
66  args.copyOut(virt_proxy);
67  }
68  break;
70  {
71  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_CREATE_QUEUE\n");
72 
73  allocateQueue(tc, ioc_buf);
74 
75  DPRINTF(GPUDriver, "Creating queue %d\n", queueId);
76  }
77  break;
79  {
81  args.copyIn(virt_proxy);
82  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_DESTROY_QUEUE;" \
83  "queue offset %d\n", args->queue_id);
85  }
86  break;
88  {
89  warn("unimplemented ioctl: AMDKFD_IOC_SET_MEMORY_POLICY\n");
90  }
91  break;
93  {
94  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_GET_CLOCK_COUNTERS\n");
95 
97  args.copyIn(virt_proxy);
98 
99  // Set nanosecond resolution
100  args->system_clock_freq = 1000000000;
101 
106  uint64_t elapsed_nsec = curTick() / SimClock::Int::ns;
107  args->gpu_clock_counter = elapsed_nsec;
108  args->cpu_clock_counter = elapsed_nsec;
109  args->system_clock_counter = elapsed_nsec;
110 
111  args.copyOut(virt_proxy);
112  }
113  break;
115  {
116  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_GET_PROCESS_APERTURES\n");
117 
119  args->num_of_nodes = 1;
120 
127  for (int i = 0; i < args->num_of_nodes; ++i) {
135  = scratchApeBase(i + 1);
138 
139  args->process_apertures[i].lds_base = ldsApeBase(i + 1);
140  args->process_apertures[i].lds_limit =
142 
146 
147  // NOTE: Must match ID populated by hsaTopology.py
148  args->process_apertures[i].gpu_id = 2765;
149 
150  DPRINTF(GPUDriver, "GPUVM base for node[%i] = %#x\n", i,
152  DPRINTF(GPUDriver, "GPUVM limit for node[%i] = %#x\n", i,
154 
155  DPRINTF(GPUDriver, "LDS base for node[%i] = %#x\n", i,
156  args->process_apertures[i].lds_base);
157  DPRINTF(GPUDriver, "LDS limit for node[%i] = %#x\n", i,
158  args->process_apertures[i].lds_limit);
159 
160  DPRINTF(GPUDriver, "Scratch base for node[%i] = %#x\n", i,
162  DPRINTF(GPUDriver, "Scratch limit for node[%i] = %#x\n", i,
164 
171  assert(bits<Addr>(args->process_apertures[i].scratch_base, 63,
172  47) != 0x1ffff);
173  assert(bits<Addr>(args->process_apertures[i].scratch_base, 63,
174  47) != 0);
175  assert(bits<Addr>(args->process_apertures[i].scratch_limit, 63,
176  47) != 0x1ffff);
177  assert(bits<Addr>(args->process_apertures[i].scratch_limit, 63,
178  47) != 0);
179  assert(bits<Addr>(args->process_apertures[i].lds_base, 63,
180  47) != 0x1ffff);
181  assert(bits<Addr>(args->process_apertures[i].lds_base, 63,
182  47) != 0);
183  assert(bits<Addr>(args->process_apertures[i].lds_limit, 63,
184  47) != 0x1ffff);
185  assert(bits<Addr>(args->process_apertures[i].lds_limit, 63,
186  47) != 0);
187  assert(bits<Addr>(args->process_apertures[i].gpuvm_base, 63,
188  47) != 0x1ffff);
189  assert(bits<Addr>(args->process_apertures[i].gpuvm_base, 63,
190  47) != 0);
191  assert(bits<Addr>(args->process_apertures[i].gpuvm_limit, 63,
192  47) != 0x1ffff);
193  assert(bits<Addr>(args->process_apertures[i].gpuvm_limit, 63,
194  47) != 0);
195  }
196 
197  args.copyOut(virt_proxy);
198  }
199  break;
201  {
202  warn("unimplemented ioctl: AMDKFD_IOC_UPDATE_QUEUE\n");
203  }
204  break;
206  {
207  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_CREATE_EVENT\n");
208 
210  args.copyIn(virt_proxy);
211  if (args->event_type != KFD_IOC_EVENT_SIGNAL) {
212  fatal("Signal events are only supported currently\n");
213  } else if (eventSlotIndex == SLOTS_PER_PAGE) {
214  fatal("Signal event wasn't created; signal limit reached\n");
215  }
216  // Currently, we allocate only one signal_page for events.
217  // Note that this signal page is of size 8 * KFD_SIGNAL_EVENT_LIMIT
218  uint64_t page_index = 0;
219  args->event_page_offset = (page_index | KFD_MMAP_TYPE_EVENTS);
220  args->event_page_offset <<= PAGE_SHIFT;
221  // TODO: Currently we support only signal events, hence using
222  // the same ID for both signal slot and event slot
224  args->event_id = eventSlotIndex++;
225  args->event_trigger_data = args->event_id;
226  DPRINTF(GPUDriver, "amdkfd create events"
227  "(event_id: 0x%x, offset: 0x%x)\n",
228  args->event_id, args->event_page_offset);
229  // Since eventSlotIndex is increased everytime a new event is
230  // created ETable at eventSlotIndex(event_id) is guaranteed to be
231  // empty. In a future implementation that reuses deleted event_ids,
232  // we should check if event table at this
233  // eventSlotIndex(event_id) is empty before inserting a new event
234  // table entry
235  ETable.emplace(std::pair<uint32_t, ETEntry>(args->event_id, {}));
236  args.copyOut(virt_proxy);
237  }
238  break;
240  {
241  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_DESTROY_EVENT\n");
243  args.copyIn(virt_proxy);
244  DPRINTF(GPUDriver, "amdkfd destroying event %d\n", args->event_id);
245  fatal_if(ETable.count(args->event_id) == 0,
246  "Event ID invalid, cannot destroy this event\n");
247  ETable.erase(args->event_id);
248  }
249  break;
251  {
252  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_SET_EVENTS\n");
254  args.copyIn(virt_proxy);
255  DPRINTF(GPUDriver, "amdkfd set event %d\n", args->event_id);
256  fatal_if(ETable.count(args->event_id) == 0,
257  "Event ID invlaid, cannot set this event\n");
258  ETable[args->event_id].setEvent = true;
260  }
261  break;
263  {
264  warn("unimplemented ioctl: AMDKFD_IOC_RESET_EVENT\n");
265  }
266  break;
268  {
269  DPRINTF(GPUDriver, "ioctl: AMDKFD_IOC_WAIT_EVENTS\n");
271  args.copyIn(virt_proxy);
272  kfd_event_data *events =
273  (kfd_event_data *)args->events_ptr;
274  DPRINTF(GPUDriver, "amdkfd wait for events"
275  "(wait on all: %d, timeout : %d, num_events: %s)\n",
276  args->wait_for_all, args->timeout, args->num_events);
277  panic_if(args->wait_for_all != 0 && args->num_events > 1,
278  "Wait for all events not supported\n");
279  bool should_sleep = true;
280  if (TCEvents.count(tc) == 0) {
281  // This thread context trying to wait on an event for the first
282  // time, initialize it.
283  TCEvents.emplace(std::piecewise_construct, std::make_tuple(tc),
284  std::make_tuple(this, tc));
285  DPRINTF(GPUDriver, "\tamdkfd creating event list"
286  " for thread %d\n", tc->cpuId());
287  }
288  panic_if(TCEvents[tc].signalEvents.size() != 0,
289  "There are %d events that put this thread to sleep,"
290  " this thread should not be running\n",
291  TCEvents[tc].signalEvents.size());
292  for (int i = 0; i < args->num_events; i++) {
293  panic_if(!events,
294  "Event pointer invalid\n");
295  Addr eventDataAddr = (Addr)(events + i);
297  eventDataAddr, sizeof(kfd_event_data));
298  EventData.copyIn(virt_proxy);
299  DPRINTF(GPUDriver,
300  "\tamdkfd wait for event %d\n", EventData->event_id);
301  panic_if(ETable.count(EventData->event_id) == 0,
302  "Event ID invalid, cannot set this event\n");
303  panic_if(ETable[EventData->event_id].threadWaiting,
304  "Multiple threads waiting on the same event\n");
305  if (ETable[EventData->event_id].setEvent) {
306  // If event is already set, the event has already happened.
307  // Just unset the event and dont put this thread to sleep.
308  ETable[EventData->event_id].setEvent = false;
309  should_sleep = false;
310  }
311  if (should_sleep) {
312  // Put this thread to sleep
313  ETable[EventData->event_id].threadWaiting = true;
314  ETable[EventData->event_id].tc = tc;
315  TCEvents[tc].signalEvents.insert(EventData->event_id);
316  }
317  }
318 
319  // TODO: Return the correct wait_result back. Currently, returning
320  // success for both KFD_WAIT_TIMEOUT and KFD_WAIT_COMPLETE.
321  // Ideally, this needs to be done after the event is triggered and
322  // after the thread is woken up.
323  args->wait_result = 0;
324  args.copyOut(virt_proxy);
325  if (should_sleep) {
326  // Put this thread to sleep
327  sleepCPU(tc, args->timeout);
328  } else {
329  // Remove events that tried to put this thread to sleep
330  TCEvents[tc].clearEvents();
331  }
332  }
333  break;
335  {
336  warn("unimplemented ioctl: AMDKFD_IOC_DBG_REGISTER\n");
337  }
338  break;
340  {
341  warn("unimplemented ioctl: AMDKFD_IOC_DBG_UNREGISTER\n");
342  }
343  break;
345  {
346  warn("unimplemented ioctl: AMDKFD_IOC_DBG_ADDRESS_WATCH\n");
347  }
348  break;
350  {
351  warn("unimplemented ioctl: AMDKFD_IOC_DBG_WAVE_CONTROL\n");
352  }
353  break;
355  {
356  warn("unimplemented ioctl: AMDKFD_IOC_ALLOC_MEMORY_OF_GPU\n");
357  }
358  break;
360  {
361  warn("unimplemented ioctl: AMDKFD_IOC_FREE_MEMORY_OF_GPU\n");
362  }
363  break;
365  {
366  warn("unimplemented ioctl: AMDKFD_IOC_MAP_MEMORY_TO_GPU\n");
367  }
368  break;
370  {
371  warn("unimplemented ioctl: AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU\n");
372  }
373  break;
375  {
376  warn("unimplemented ioctl: AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH\n");
377  }
378  break;
380  {
381  warn("unimplemented ioctl: AMDKFD_IOC_SET_CU_MASK\n");
382  }
383  break;
385  {
386  warn("unimplemented ioctl: AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE"
387  "\n");
388  }
389  break;
391  {
392  warn("unimplemented ioctl: AMDKFD_IOC_SET_TRAP_HANDLER\n");
393  }
394  break;
396  {
397  DPRINTF(GPUDriver,
398  "ioctl: AMDKFD_IOC_GET_PROCESS_APERTURES_NEW\n");
399 
401  ioc_args(ioc_buf);
402 
403  ioc_args.copyIn(virt_proxy);
404  ioc_args->num_of_nodes = 1;
405 
406  for (int i = 0; i < ioc_args->num_of_nodes; ++i) {
409 
410  ape_args->scratch_base = scratchApeBase(i + 1);
411  ape_args->scratch_limit =
412  scratchApeLimit(ape_args->scratch_base);
413  ape_args->lds_base = ldsApeBase(i + 1);
414  ape_args->lds_limit = ldsApeLimit(ape_args->lds_base);
415  ape_args->gpuvm_base = gpuVmApeBase(i + 1);
416  ape_args->gpuvm_limit = gpuVmApeLimit(ape_args->gpuvm_base);
417 
418  ape_args->gpu_id = 2765;
419 
420  assert(bits<Addr>(ape_args->scratch_base, 63, 47) != 0x1ffff);
421  assert(bits<Addr>(ape_args->scratch_base, 63, 47) != 0);
422  assert(bits<Addr>(ape_args->scratch_limit, 63, 47) != 0x1ffff);
423  assert(bits<Addr>(ape_args->scratch_limit, 63, 47) != 0);
424  assert(bits<Addr>(ape_args->lds_base, 63, 47) != 0x1ffff);
425  assert(bits<Addr>(ape_args->lds_base, 63, 47) != 0);
426  assert(bits<Addr>(ape_args->lds_limit, 63, 47) != 0x1ffff);
427  assert(bits<Addr>(ape_args->lds_limit, 63, 47) != 0);
428  assert(bits<Addr>(ape_args->gpuvm_base, 63, 47) != 0x1ffff);
429  assert(bits<Addr>(ape_args->gpuvm_base, 63, 47) != 0);
430  assert(bits<Addr>(ape_args->gpuvm_limit, 63, 47) != 0x1ffff);
431  assert(bits<Addr>(ape_args->gpuvm_limit, 63, 47) != 0);
432 
433  ape_args.copyOut(virt_proxy);
434  }
435 
436  ioc_args.copyOut(virt_proxy);
437  }
438  break;
440  {
441  warn("unimplemented ioctl: AMDKFD_IOC_GET_DMABUF_INFO\n");
442  }
443  break;
445  {
446  warn("unimplemented ioctl: AMDKFD_IOC_IMPORT_DMABUF\n");
447  }
448  break;
450  {
451  warn("unimplemented ioctl: AMDKFD_IOC_GET_TILE_CONFIG\n");
452  }
453  break;
455  {
456  warn("unimplemented ioctl: AMDKFD_IOC_IPC_IMPORT_HANDLE\n");
457  }
458  break;
460  {
461  warn("unimplemented ioctl: AMDKFD_IOC_IPC_EXPORT_HANDLE\n");
462  }
463  break;
465  {
466  warn("unimplemented ioctl: AMDKFD_IOC_CROSS_MEMORY_COPY\n");
467  }
468  break;
470  {
471  warn("unimplemented ioctl: AMDKFD_IOC_OPEN_GRAPHIC_HANDLE\n");
472  }
473  break;
474  default:
475  fatal("%s: bad ioctl %d\n", req);
476  break;
477  }
478  return 0;
479 }
480 
481 void
482 GPUComputeDriver::sleepCPU(ThreadContext *tc, uint32_t milliSecTimeout)
483 {
484  // Convert millisecs to ticks
485  Tick wakeup_delay((uint64_t)milliSecTimeout * 1000000000);
486  assert(TCEvents.count(tc) == 1);
487  TCEvents[tc].timerEvent.scheduleWakeup(wakeup_delay);
488  tc->suspend();
489  DPRINTF(GPUDriver,
490  "CPU %d is put to sleep\n", tc->cpuId());
491 }
492 
493 Addr
495 {
496  return ((Addr)gpuNum << 61) + 0x1000000000000L;
497 }
498 
499 Addr
501 {
502  return (apeBase & 0xFFFFFF0000000000UL) | 0xFFFFFFFFFFL;
503 }
504 
505 Addr
507 {
508  return ((Addr)gpuNum << 61) + 0x100000000L;
509 }
510 
511 Addr
513 {
514  return (apeBase & 0xFFFFFFFF00000000UL) | 0xFFFFFFFF;
515 }
516 
517 Addr
519 {
520  return ((Addr)gpuNum << 61) + 0x0;
521 }
522 
523 Addr
525 {
526  return (apeBase & 0xFFFFFFFF00000000UL) | 0xFFFFFFFF;
527 }
kfd_ioctl_get_version_args::minor_version
uint32_t minor_version
Definition: kfd_ioctl.h:34
GPUComputeDriver::scratchApeLimit
Addr scratchApeLimit(Addr apeBase) const
Definition: gpu_compute_driver.cc:512
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
AMDKFD_IOC_MAP_MEMORY_TO_GPU
#define AMDKFD_IOC_MAP_MEMORY_TO_GPU
Definition: kfd_ioctl.h:489
X86ISA::L
Bitfield< 7, 0 > L
Definition: int.hh:57
SimClock::Int::ns
Tick ns
nanosecond
Definition: core.cc:62
warn
#define warn(...)
Definition: logging.hh:239
kfd_ioctl_get_process_apertures_new_args::kfd_process_device_apertures_ptr
uint64_t kfd_process_device_apertures_ptr
Definition: kfd_ioctl.h:153
kfd_process_device_apertures::gpuvm_limit
uint64_t gpuvm_limit
Definition: kfd_ioctl.h:131
GPUComputeDriver::ldsApeBase
Addr ldsApeBase(int gpuNum) const
Definition: gpu_compute_driver.cc:518
AMDKFD_IOC_GET_TILE_CONFIG
#define AMDKFD_IOC_GET_TILE_CONFIG
Definition: kfd_ioctl.h:517
kfd_process_device_apertures::lds_base
uint64_t lds_base
Definition: kfd_ioctl.h:126
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
AMDKFD_IOC_DBG_WAVE_CONTROL
#define AMDKFD_IOC_DBG_WAVE_CONTROL
Definition: kfd_ioctl.h:480
AMDKFD_IOC_FREE_MEMORY_OF_GPU
#define AMDKFD_IOC_FREE_MEMORY_OF_GPU
Definition: kfd_ioctl.h:486
kfd_ioctl_create_event_args::event_page_offset
uint64_t event_page_offset
Definition: kfd_ioctl.h:213
hsa_packet_processor.hh
AMDKFD_IOC_DESTROY_EVENT
#define AMDKFD_IOC_DESTROY_EVENT
Definition: kfd_ioctl.h:459
AMDKFD_IOC_IPC_EXPORT_HANDLE
#define AMDKFD_IOC_IPC_EXPORT_HANDLE
Definition: kfd_ioctl.h:523
kfd_ioctl_get_clock_counters_args::system_clock_counter
uint64_t system_clock_counter
Definition: kfd_ioctl.h:116
ThreadContext::suspend
virtual void suspend()=0
Set the status to Suspended.
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:59
kfd_ioctl_get_process_apertures_args::process_apertures
struct kfd_process_device_apertures process_apertures[NUM_OF_SUPPORTED_GPUS]
Definition: kfd_ioctl.h:141
kfd_process_device_apertures::gpu_id
uint32_t gpu_id
Definition: kfd_ioctl.h:132
syscall_emul_buf.hh
KFD_IOCTL_MINOR_VERSION
#define KFD_IOCTL_MINOR_VERSION
Definition: kfd_ioctl.h:30
kfd_ioctl_create_event_args::event_type
uint32_t event_type
Definition: kfd_ioctl.h:215
AMDKFD_IOC_GET_VERSION
#define AMDKFD_IOC_GET_VERSION
Definition: kfd_ioctl.h:435
kfd_ioctl_wait_events_args::events_ptr
uint64_t events_ptr
Definition: kfd_ioctl.h:265
AMDKFD_IOC_CROSS_MEMORY_COPY
#define AMDKFD_IOC_CROSS_MEMORY_COPY
Definition: kfd_ioctl.h:526
kfd_ioctl_get_clock_counters_args::system_clock_freq
uint64_t system_clock_freq
Definition: kfd_ioctl.h:117
HSADriver::TCEvents
std::unordered_map< ThreadContext *, EventList > TCEvents
Definition: hsa_driver.hh:147
kfd_ioctl_get_clock_counters_args::gpu_clock_counter
uint64_t gpu_clock_counter
Definition: kfd_ioctl.h:114
AMDKFD_IOC_SET_EVENT
#define AMDKFD_IOC_SET_EVENT
Definition: kfd_ioctl.h:462
kfd_ioctl_get_clock_counters_args::cpu_clock_counter
uint64_t cpu_clock_counter
Definition: kfd_ioctl.h:115
kfd_ioctl_create_event_args::event_trigger_data
uint32_t event_trigger_data
Definition: kfd_ioctl.h:214
AMDKFD_IOC_GET_PROCESS_APERTURES
#define AMDKFD_IOC_GET_PROCESS_APERTURES
Definition: kfd_ioctl.h:450
AMDKFD_IOC_SET_TRAP_HANDLER
#define AMDKFD_IOC_SET_TRAP_HANDLER
Definition: kfd_ioctl.h:505
GPUComputeDriver::Params
GPUComputeDriverParams Params
Definition: gpu_compute_driver.hh:52
AMDKFD_IOC_DBG_REGISTER
#define AMDKFD_IOC_DBG_REGISTER
Definition: kfd_ioctl.h:471
GPUComputeDriver::sleepCPU
void sleepCPU(ThreadContext *tc, uint32_t milliSecTimeout)
Definition: gpu_compute_driver.cc:482
GPUComputeDriver::ldsApeLimit
Addr ldsApeLimit(Addr apeBase) const
Definition: gpu_compute_driver.cc:524
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
HSADriver::queueId
uint32_t queueId
Definition: hsa_driver.hh:153
kfd_ioctl_wait_events_args::timeout
uint32_t timeout
Definition: kfd_ioctl.h:269
kfd_ioctl_get_process_apertures_args::num_of_nodes
uint32_t num_of_nodes
Definition: kfd_ioctl.h:145
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:237
GPUComputeDriver::gpuVmApeLimit
Addr gpuVmApeLimit(Addr apeBase) const
Definition: gpu_compute_driver.cc:500
GPUComputeDriver::scratchApeBase
Addr scratchApeBase(int gpuNum) const
Definition: gpu_compute_driver.cc:506
AMDKFD_IOC_SET_CU_MASK
#define AMDKFD_IOC_SET_CU_MASK
Definition: kfd_ioctl.h:498
AMDKFD_IOC_IPC_IMPORT_HANDLE
#define AMDKFD_IOC_IPC_IMPORT_HANDLE
Definition: kfd_ioctl.h:520
HSAPacketProcessor::unsetDeviceQueueDesc
void unsetDeviceQueueDesc(uint64_t queue_id)
Definition: hsa_packet_processor.cc:94
PAGE_SHIFT
#define PAGE_SHIFT
Definition: kfd_event_defines.h:38
kfd_process_device_apertures::gpuvm_base
uint64_t gpuvm_base
Definition: kfd_ioctl.h:130
kfd_event_defines.h
KFD_IOCTL_MAJOR_VERSION
#define KFD_IOCTL_MAJOR_VERSION
Definition: kfd_ioctl.h:29
AMDKFD_IOC_RESET_EVENT
#define AMDKFD_IOC_RESET_EVENT
Definition: kfd_ioctl.h:465
ThreadContext::cpuId
virtual int cpuId() const =0
KFD_IOC_EVENT_SIGNAL
#define KFD_IOC_EVENT_SIGNAL
Definition: kfd_ioctl.h:189
AMDKFD_IOC_DBG_ADDRESS_WATCH
#define AMDKFD_IOC_DBG_ADDRESS_WATCH
Definition: kfd_ioctl.h:477
std::pair
STL pair class.
Definition: stl.hh:58
GPUComputeDriver::ioctl
int ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf) override
Abstract method, invoked when the user program calls ioctl() on the file descriptor returned by a pre...
Definition: gpu_compute_driver.cc:53
kfd_event_data
Definition: kfd_ioctl.h:254
kfd_process_device_apertures::scratch_limit
uint64_t scratch_limit
Definition: kfd_ioctl.h:129
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
kfd_ioctl_set_event_args::event_id
uint32_t event_id
Definition: kfd_ioctl.h:229
kfd_ioctl_get_version_args::major_version
uint32_t major_version
Definition: kfd_ioctl.h:33
kfd_event_data::event_id
uint32_t event_id
Definition: kfd_ioctl.h:260
GPUComputeDriver::gpuVmApeBase
Addr gpuVmApeBase(int gpuNum) const
The aperture (APE) base/limit pairs are set statically at startup by the real KFD.
Definition: gpu_compute_driver.cc:494
BaseBufferArg::copyIn
bool copyIn(PortProxy &memproxy)
copy data into simulator space (read from target memory)
Definition: syscall_emul_buf.hh:77
AMDKFD_IOC_IMPORT_DMABUF
#define AMDKFD_IOC_IMPORT_DMABUF
Definition: kfd_ioctl.h:514
KFD_MMAP_TYPE_EVENTS
#define KFD_MMAP_TYPE_EVENTS
Definition: kfd_event_defines.h:42
kfd_ioctl_wait_events_args::wait_result
uint32_t wait_result
Definition: kfd_ioctl.h:270
ThreadContext::getVirtProxy
virtual PortProxy & getVirtProxy()=0
panic_if
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:197
HSADevice::hsaPacketProc
HSAPacketProcessor & hsaPacketProc()
Definition: hsa_device.cc:40
kfd_ioctl_destroy_event_args::event_id
uint32_t event_id
Definition: kfd_ioctl.h:224
HSADriver::eventSlotIndex
uint32_t eventSlotIndex
Definition: hsa_driver.hh:112
AMDKFD_IOC_CREATE_EVENT
#define AMDKFD_IOC_CREATE_EVENT
Definition: kfd_ioctl.h:456
AMDKFD_IOC_DESTROY_QUEUE
#define AMDKFD_IOC_DESTROY_QUEUE
Definition: kfd_ioctl.h:441
kfd_ioctl_wait_events_args::wait_for_all
uint32_t wait_for_all
Definition: kfd_ioctl.h:268
AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU
#define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU
Definition: kfd_ioctl.h:492
AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH
#define AMDKFD_IOC_ALLOC_MEMORY_OF_SCRATCH
Definition: kfd_ioctl.h:495
SLOTS_PER_PAGE
#define SLOTS_PER_PAGE
Definition: kfd_event_defines.h:43
AMDKFD_IOC_SET_MEMORY_POLICY
#define AMDKFD_IOC_SET_MEMORY_POLICY
Definition: kfd_ioctl.h:444
AMDKFD_IOC_WAIT_EVENTS
#define AMDKFD_IOC_WAIT_EVENTS
Definition: kfd_ioctl.h:468
kfd_ioctl_create_event_args::event_slot_index
uint32_t event_slot_index
Definition: kfd_ioctl.h:220
AMDKFD_IOC_OPEN_GRAPHIC_HANDLE
#define AMDKFD_IOC_OPEN_GRAPHIC_HANDLE
Definition: kfd_ioctl.h:530
HSADriver::signalWakeupEvent
virtual void signalWakeupEvent(uint32_t event_id)
Definition: hsa_driver.cc:157
GPUComputeDriver::GPUComputeDriver
GPUComputeDriver(const Params &p)
Definition: gpu_compute_driver.cc:45
AMDKFD_IOC_DBG_UNREGISTER
#define AMDKFD_IOC_DBG_UNREGISTER
Definition: kfd_ioctl.h:474
TypedBufferArg
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
Definition: syscall_emul_buf.hh:128
curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:43
HSADriver
Definition: hsa_driver.hh:61
kfd_process_device_apertures::scratch_base
uint64_t scratch_base
Definition: kfd_ioctl.h:128
AMDKFD_IOC_UPDATE_QUEUE
#define AMDKFD_IOC_UPDATE_QUEUE
Definition: kfd_ioctl.h:453
gpu_compute_driver.hh
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
HSADriver::ETable
std::unordered_map< uint32_t, ETEntry > ETable
Definition: hsa_driver.hh:114
HSADriver::device
HSADevice * device
HSA agent (device) that is controled by this driver.
Definition: hsa_driver.hh:152
HSADevice::attachDriver
virtual void attachDriver(HSADriver *driver)
Definition: hsa_device.hh:94
AMDKFD_IOC_GET_PROCESS_APERTURES_NEW
#define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW
Definition: kfd_ioctl.h:508
fatal_if
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition: logging.hh:219
hsa_device.hh
HSADriver::allocateQueue
void allocateQueue(ThreadContext *tc, Addr ioc_buf)
Forward relevant parameters to packet processor; queueID is used to link doorbell.
Definition: hsa_driver.cc:128
AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE
#define AMDKFD_IOC_SET_PROCESS_DGPU_APERTURE
Definition: kfd_ioctl.h:501
kfd_ioctl_create_event_args::event_id
uint32_t event_id
Definition: kfd_ioctl.h:219
kfd_ioctl.h
kfd_process_device_apertures::lds_limit
uint64_t lds_limit
Definition: kfd_ioctl.h:127
kfd_ioctl_destroy_queue_args::queue_id
uint32_t queue_id
Definition: kfd_ioctl.h:66
kfd_ioctl_wait_events_args::num_events
uint32_t num_events
Definition: kfd_ioctl.h:267
thread_context.hh
AMDKFD_IOC_ALLOC_MEMORY_OF_GPU
#define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU
Definition: kfd_ioctl.h:483
kfd_ioctl_get_process_apertures_new_args::num_of_nodes
uint32_t num_of_nodes
Definition: kfd_ioctl.h:158
AMDKFD_IOC_CREATE_QUEUE
#define AMDKFD_IOC_CREATE_QUEUE
Definition: kfd_ioctl.h:438
BaseBufferArg::copyOut
bool copyOut(PortProxy &memproxy)
copy data out of simulator space (write to target memory)
Definition: syscall_emul_buf.hh:87
AMDKFD_IOC_GET_CLOCK_COUNTERS
#define AMDKFD_IOC_GET_CLOCK_COUNTERS
Definition: kfd_ioctl.h:447
AMDKFD_IOC_GET_DMABUF_INFO
#define AMDKFD_IOC_GET_DMABUF_INFO
Definition: kfd_ioctl.h:511

Generated on Tue Mar 23 2021 19:41:27 for gem5 by doxygen 1.8.17