[gem5-dev] Change in gem5/gem5[develop]: dev-hsa,gpu-compute: IOCTL updates for ROCm 4

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46246 )



Change subject: dev-hsa,gpu-compute: IOCTL updates for ROCm 4
..

dev-hsa,gpu-compute: IOCTL updates for ROCm 4

This change copies over the up-to-date kfd_ioctl.h file from the linux
kernel, and updates the gpu_compute_driver to reflect the changes found
in the new version of the kfd_ioctl.h file

Change-Id: I51e8e7158762f4b7e06c0f84507e5889a17939a2
---
M src/dev/hsa/kfd_ioctl.h
M src/gpu-compute/gpu_compute_driver.cc
2 files changed, 371 insertions(+), 335 deletions(-)



diff --git a/src/dev/hsa/kfd_ioctl.h b/src/dev/hsa/kfd_ioctl.h
index 504621c..5ba0a0c 100644
--- a/src/dev/hsa/kfd_ioctl.h
+++ b/src/dev/hsa/kfd_ioctl.h
@@ -23,13 +23,16 @@
 #ifndef KFD_IOCTL_H_INCLUDED
 #define KFD_IOCTL_H_INCLUDED

+#include 
 #include 
 #include 

-#include 
-
+/*
+ * - 1.1 - initial version
+ * - 1.3 - Add SMI events support
+ */
 #define KFD_IOCTL_MAJOR_VERSION 1
-#define KFD_IOCTL_MINOR_VERSION 2
+#define KFD_IOCTL_MINOR_VERSION 3

 struct kfd_ioctl_get_version_args
 {
@@ -41,6 +44,7 @@
 #define KFD_IOC_QUEUE_TYPE_COMPUTE 0
 #define KFD_IOC_QUEUE_TYPE_SDMA1
 #define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
+#define KFD_IOC_QUEUE_TYPE_SDMA_XGMI   3

 #define KFD_MAX_QUEUE_PERCENTAGE   100
 #define KFD_MAX_QUEUE_PRIORITY 15
@@ -69,7 +73,7 @@
 struct kfd_ioctl_destroy_queue_args
 {
uint32_t queue_id;  /* to KFD */
-   uint32_t pad;
+uint32_t pad;
 };

 struct kfd_ioctl_update_queue_args
@@ -78,15 +82,24 @@

uint32_t queue_id;  /* to KFD */
uint32_t ring_size; /* to KFD */
-   uint32_t queue_percentage;  /* to KFD */
-   uint32_t queue_priority;/* to KFD */
+uint32_t queue_percentage; /* to KFD */
+uint32_t queue_priority;   /* to KFD */
 };

 struct kfd_ioctl_set_cu_mask_args
 {
-   uint32_t queue_id;  /* to KFD */
-   uint32_t num_cu_mask;   /* to KFD */
-   uint64_t cu_mask_ptr;   /* to KFD */
+uint32_t queue_id; /* to KFD */
+uint32_t num_cu_mask;  /* to KFD */
+uint64_t cu_mask_ptr;  /* to KFD */
+};
+
+struct kfd_ioctl_get_queue_wave_state_args
+{
+uint64_t ctl_stack_address;/* to KFD */
+uint32_t ctl_stack_used_size;  /* from KFD */
+uint32_t save_area_used_size;  /* from KFD */
+uint32_t queue_id; /* to KFD */
+uint32_t pad;
 };

 /* For kfd_ioctl_set_memory_policy_args.default_policy and  
alternate_policy */

@@ -104,14 +117,6 @@
uint32_t pad;
 };

-struct kfd_ioctl_set_trap_handler_args
-{
-   uint64_t tba_addr;
-   uint64_t tma_addr;
-   uint32_t gpu_id;/* to KFD */
-   uint32_t pad;
-};
-
 /*
  * All counters are monotonic. They are used for profiling of compute jobs.
  * The profiling is done by userspace.
@@ -122,32 +127,32 @@
 struct kfd_ioctl_get_clock_counters_args
 {
uint64_t gpu_clock_counter; /* from KFD */
-   uint64_t cpu_clock_counter; /* from KFD */
-   uint64_t system_clock_counter;  /* from KFD */
-   uint64_t system_clock_freq; /* from KFD */
+uint64_t cpu_clock_counter;/* from KFD */
+uint64_t system_clock_counter; /* from KFD */
+uint64_t system_clock_freq;/* from KFD */

uint32_t gpu_id;/* to KFD */
uint32_t pad;
 };

-#define NUM_OF_SUPPORTED_GPUS 7
-
 struct kfd_process_device_apertures
 {
uint64_t lds_base;  /* from KFD */
-   uint64_t lds_limit; /* from KFD */
-   uint64_t scratch_base;  /* from KFD */
-   uint64_t scratch_limit; /* from KFD */
-   uint64_t gpuvm_base;/* from KFD */
-   uint64_t gpuvm_limit;   /* from KFD */
-   uint32_t gpu_id;/* from KFD */
-   uint32_t pad;
+uint64_t lds_limit;/* from KFD */
+uint64_t scratch_base; /* from KFD */
+uint64_t scratch_limit;/* from KFD */
+uint64_t gpuvm_base;   /* from KFD */
+uint64_t gpuvm_limit;  /* from KFD */
+uint32_t gpu_id;   /* from KFD */
+uint32_t pad;
 };

-/* This IOCTL and the limited NUM_OF_SUPPORTED_GPUS is deprecated. Use
- * kfd_ioctl_get_process_apertures_new instead, which supports
- * arbitrary numbers of GPUs.
+/*
+ * AMDKFD_IOC_GET_PROCESS_APERTURES is deprecated. Use
+ * AMDKFD_IOC_GET_PROCESS_APERTURES_NEW instead, which supports an
+ * unlimited number of GPUs.
  */
+#define NUM_OF_SUPPORTED_GPUS 7
 struct kfd_ioctl_get_process_apertures_args
 {
struct kfd_process_device_apertures
@@ -165,11 +170,11 @@
 */
uint64_t 

[gem5-dev] Change in gem5/gem5[develop]: gpu-compute: Ignore GPU kernel names

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46245 )



Change subject: gpu-compute: Ignore GPU kernel names
..

gpu-compute: Ignore GPU kernel names

ROCm 4 seems to have updated the akc, and the only real issue that has
occured is that we're no longer able to read kernel names in the same
way as we were in ROCm 1.6. This patch removes the prior method of
reading kernel names and gives all kernels a temporary name

Change-Id: I0040e0cf4cd35d6f56ded6a8acfb10c600bcc77a
---
M src/gpu-compute/gpu_command_processor.cc
1 file changed, 1 insertion(+), 5 deletions(-)



diff --git a/src/gpu-compute/gpu_command_processor.cc  
b/src/gpu-compute/gpu_command_processor.cc

index 9bdd0b9..78b3235 100644
--- a/src/gpu-compute/gpu_command_processor.cc
+++ b/src/gpu-compute/gpu_command_processor.cc
@@ -171,7 +171,6 @@
 DPRINTF(GPUCommandProc, "Machine code starts at addr: %#x\n",
 machine_code_addr);

-Addr kern_name_addr(0);
 std::string kernel_name;

 /**
@@ -184,10 +183,7 @@
  * host memory.  I have no idea what BLIT stands for.
  * */
 if (akc.runtime_loader_kernel_symbol) {
-virt_proxy.readBlob(akc.runtime_loader_kernel_symbol + 0x10,
-(uint8_t*)_name_addr, 0x8);
-
-virt_proxy.readString(kernel_name, kern_name_addr);
+kernel_name = "Some kernel";
 } else {
 kernel_name = "Blit kernel";
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46245
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I0040e0cf4cd35d6f56ded6a8acfb10c600bcc77a
Gerrit-Change-Number: 46245
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: arch-x86,sim: (WIP) Workaround for sched_getaffinity

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46243 )



Change subject: arch-x86,sim: (WIP) Workaround for sched_getaffinity
..

arch-x86,sim: (WIP) Workaround for sched_getaffinity

sched_getaffinity is different from other syscalls in the raw syscall
return the size of the cpumask being used to represent the CPU bit mask.

Because of this, when a library (libnuma in this case) directly called
sched_getaffinity and got a return value of 0, it errored out, thinking
that there were no CPUs available.

Currently the implementation just returns 1, and it's being used as a
proof-of-concept for ROCm 4 support, as ROCm 4 support uses libnuma.

Change-Id: Id95c919986cc98a411877056256604f57a29f0f9
---
M src/arch/x86/linux/syscall_tbl64.cc
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
3 files changed, 12 insertions(+), 1 deletion(-)



diff --git a/src/arch/x86/linux/syscall_tbl64.cc  
b/src/arch/x86/linux/syscall_tbl64.cc

index 94837cd..bb24f3d 100644
--- a/src/arch/x86/linux/syscall_tbl64.cc
+++ b/src/arch/x86/linux/syscall_tbl64.cc
@@ -244,7 +244,7 @@
 { 201, "time", timeFunc },
 { 202, "futex", futexFunc },
 { 203, "sched_setaffinity", ignoreFunc },
-{ 204, "sched_getaffinity", ignoreFunc },
+{ 204, "sched_getaffinity", schedGetaffinityFunc },
 { 205, "set_thread_area" },
 { 206, "io_setup" },
 { 207, "io_destroy" },
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index bb8b42a..17a947a 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -1650,3 +1650,10 @@

 return 0;
 }
+
+SyscallReturn
+schedGetaffinityFunc(SyscallDesc *desc, ThreadContext *tc,
+ pid_t pid, size_t cpusetsize, Addr mask)
+{
+return 1;
+}
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 54e92b2..83e11b2 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -367,6 +367,10 @@
 SyscallReturn getsocknameFunc(SyscallDesc *desc, ThreadContext *tc,
   int tgt_fd, VPtr<> addrPtr, VPtr<> lenPtr);

+// Target sched_getaffinity() handler
+SyscallReturn schedGetaffinityFunc(SyscallDesc *desc, ThreadContext *tc,
+   pid_t pid, size_t cpusetsize, Addr  
mask);

+
 /// Futex system call
 /// Implemented by Daniel Sanchez
 /// Used by printf's in multi-threaded apps

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46243
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id95c919986cc98a411877056256604f57a29f0f9
Gerrit-Change-Number: 46243
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: arch-x86: build with getdents64 if system supports it

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46242 )



Change subject: arch-x86: build with getdents64 if system supports it
..

arch-x86: build with getdents64 if system supports it

This patch makes it so the getdents64 syscall is built in gem5 if the
underlying host implements the syscall, similar to how the getdents
syscall is implemented.

The implementation for getdents64 already existed

Change-Id: I73b22c8df8df994f3f720e848a7d4f8cd31d318e
---
M src/arch/x86/linux/syscall_tbl32.cc
M src/arch/x86/linux/syscall_tbl64.cc
2 files changed, 8 insertions(+), 0 deletions(-)



diff --git a/src/arch/x86/linux/syscall_tbl32.cc  
b/src/arch/x86/linux/syscall_tbl32.cc

index 50d0969..db70151 100644
--- a/src/arch/x86/linux/syscall_tbl32.cc
+++ b/src/arch/x86/linux/syscall_tbl32.cc
@@ -261,7 +261,11 @@
 { 218, "mincore" },
 { 219, "madvise", ignoreFunc },
 { 220, "madvise1" },
+#if defined(SYS_getdents64)
+{ 221, "getdents64", getdents64Func },
+#else
 { 221, "getdents64" },
+#endif
 { 222, "fcntl64" },
 { 223, "unused" },
 { 224, "gettid", gettidFunc },
diff --git a/src/arch/x86/linux/syscall_tbl64.cc  
b/src/arch/x86/linux/syscall_tbl64.cc

index be82437..94837cd 100644
--- a/src/arch/x86/linux/syscall_tbl64.cc
+++ b/src/arch/x86/linux/syscall_tbl64.cc
@@ -257,7 +257,11 @@
 { 214, "epoll_ctl_old" },
 { 215, "epoll_wait_old" },
 { 216, "remap_file_pages" },
+#if defined(SYS_getdents64)
+{ 217, "getdents64", getdents64Func },
+#else
 { 217, "getdents64" },
+#endif
 { 218, "set_tid_address", setTidAddressFunc },
 { 219, "restart_syscall" },
 { 220, "semtimedop" },

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46242
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I73b22c8df8df994f3f720e848a7d4f8cd31d318e
Gerrit-Change-Number: 46242
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: gpu-compute: Change certain IOCTL errors to warnings

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46247 )



Change subject: gpu-compute: Change certain IOCTL errors to warnings
..

gpu-compute: Change certain IOCTL errors to warnings

There are certain IOCTL errors that were triggering with the change to
ROCm 4, however they could be set to warnings without causing any errors
in the program

Change-Id: Ie0052267f3ccfbdbadb90249b6f19e6a1205f57e
---
M src/gpu-compute/gpu_compute_driver.cc
1 file changed, 3 insertions(+), 3 deletions(-)



diff --git a/src/gpu-compute/gpu_compute_driver.cc  
b/src/gpu-compute/gpu_compute_driver.cc

index 7f8cc16..12e537c 100644
--- a/src/gpu-compute/gpu_compute_driver.cc
+++ b/src/gpu-compute/gpu_compute_driver.cc
@@ -417,7 +417,7 @@
 TypedBufferArg args(ioc_buf);
 args.copyIn(virt_proxy);
 if (args->event_type != KFD_IOC_EVENT_SIGNAL) {
-fatal("Signal events are only supported currently\n");
+warn("Signal events are only supported currently\n");
 } else if (eventSlotIndex == SLOTS_PER_PAGE) {
 fatal("Signal event wasn't created; signal limit  
reached\n");

 }
@@ -508,8 +508,8 @@
 "\tamdkfd wait for event %d\n",  
EventData->event_id);

 panic_if(ETable.count(EventData->event_id) == 0,
  "Event ID invalid, cannot set this event\n");
-panic_if(ETable[EventData->event_id].threadWaiting,
- "Multiple threads waiting on the same event\n");
+if (ETable[EventData->event_id].threadWaiting)
+ warn("Multiple threads waiting on the same  
event\n");

 if (ETable[EventData->event_id].setEvent) {
 // If event is already set, the event has already  
happened.
 // Just unset the event and dont put this thread to  
sleep.


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46247
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie0052267f3ccfbdbadb90249b6f19e6a1205f57e
Gerrit-Change-Number: 46247
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: gpu-compute: Initialize GPUDriver member variables before use

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46248 )



Change subject: gpu-compute: Initialize GPUDriver member variables before  
use

..

gpu-compute: Initialize GPUDriver member variables before use

A few member variables weren't initialized, but we were assuming that
they were 0 when first read. This explicitly sets those variables to 0.

Change-Id: I2c840d361ed3a7d306e22dc7561a3870f1ef94a1
---
M src/gpu-compute/gpu_compute_driver.cc
1 file changed, 2 insertions(+), 1 deletion(-)



diff --git a/src/gpu-compute/gpu_compute_driver.cc  
b/src/gpu-compute/gpu_compute_driver.cc

index 12e537c..02f1de5 100644
--- a/src/gpu-compute/gpu_compute_driver.cc
+++ b/src/gpu-compute/gpu_compute_driver.cc
@@ -53,7 +53,8 @@

 GPUComputeDriver::GPUComputeDriver(const Params )
 : EmulatedDriver(p), device(p.device), queueId(0),
-  isdGPU(p.isdGPU), gfxVersion(p.gfxVersion), dGPUPoolID(p.dGPUPoolID)
+  isdGPU(p.isdGPU), gfxVersion(p.gfxVersion), dGPUPoolID(p.dGPUPoolID),
+  eventPage(0), eventSlotIndex(0)
 {
 device->attachDriver(this);
 DPRINTF(GPUDriver, "Constructing KFD: device\n");

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46248
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2c840d361ed3a7d306e22dc7561a3870f1ef94a1
Gerrit-Change-Number: 46248
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: arch-x86: Ignore syscalls called in ROCm 4

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46241 )



Change subject: arch-x86: Ignore syscalls called in ROCm 4
..

arch-x86: Ignore syscalls called in ROCm 4

This patch ignores syscalls called by the ROCm 4 stack. Based on testing
so far, these syscalls don't affect the correctness of programs that use
ROCm 4.

sched_yield gets changed to ignoreWarnOnceFunc, as it gets called
significantly more in ROCm 4.

Change-Id: I566b1d71d989c54bfc559d5b83790dff73a38b28
---
M src/arch/x86/linux/syscall_tbl64.cc
1 file changed, 4 insertions(+), 4 deletions(-)



diff --git a/src/arch/x86/linux/syscall_tbl64.cc  
b/src/arch/x86/linux/syscall_tbl64.cc

index 8630265..be82437 100644
--- a/src/arch/x86/linux/syscall_tbl64.cc
+++ b/src/arch/x86/linux/syscall_tbl64.cc
@@ -60,7 +60,7 @@
 {  21, "access", ignoreFunc },
 {  22, "pipe", pipeFunc },
 {  23, "select", selectFunc },
-{  24, "sched_yield", ignoreFunc },
+{  24, "sched_yield", ignoreWarnOnceFunc },
 {  25, "mremap", mremapFunc },
 {  26, "msync" },
 {  27, "mincore" },
@@ -111,7 +111,7 @@
 {  72, "fcntl", fcntlFunc },
 {  73, "flock" },
 {  74, "fsync" },
-{  75, "fdatasync" },
+{  75, "fdatasync", ignoreFunc },
 {  76, "truncate", truncateFunc },
 {  77, "ftruncate", ftruncateFunc },
 #if defined(SYS_getdents)
@@ -171,7 +171,7 @@
 { 128, "rt_sigtimedwait" },
 { 129, "rt_sigqueueinfo" },
 { 130, "rt_sigsuspend" },
-{ 131, "sigaltstack" },
+{ 131, "sigaltstack", ignoreFunc },
 { 132, "utime" },
 { 133, "mknod", mknodFunc },
 { 134, "uselib" },
@@ -197,7 +197,7 @@
 { 154, "modify_ldt" },
 { 155, "pivot_root" },
 { 156, "_sysctl" },
-{ 157, "prctl" },
+{ 157, "prctl", ignoreFunc },
 { 158, "arch_prctl", archPrctlFunc },
 { 159, "adjtimex" },
 { 160, "setrlimit", ignoreFunc },

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46241
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I566b1d71d989c54bfc559d5b83790dff73a38b28
Gerrit-Change-Number: 46241
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: util: Update GCN Dockerfile for ROCm 4

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46239 )



Change subject: util: Update GCN Dockerfile for ROCm 4
..

util: Update GCN Dockerfile for ROCm 4

This now installs ROCm 4 from source instead of ROCm 1.6.

Change-Id: I380ca06e93d48475e93d18f69eb97756186772ab
---
M util/dockerfiles/gcn-gpu/Dockerfile
1 file changed, 152 insertions(+), 144 deletions(-)



diff --git a/util/dockerfiles/gcn-gpu/Dockerfile  
b/util/dockerfiles/gcn-gpu/Dockerfile

index e5683ab..491c960 100644
--- a/util/dockerfiles/gcn-gpu/Dockerfile
+++ b/util/dockerfiles/gcn-gpu/Dockerfile
@@ -1,166 +1,174 @@
-FROM ubuntu:16.04
+# Copyright (c) 2020 The Regents of the University of California
+# All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+FROM ubuntu:20.04
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt -y update
+RUN apt -y upgrade
+RUN apt -y install build-essential git m4 scons zlib1g zlib1g-dev \
+libprotobuf-dev protobuf-compiler libprotoc-dev  
libgoogle-perftools-dev \

+python3-dev python3-six python-is-python3 doxygen libboost-all-dev \
+libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config

-# Needed for add-apt-repository
-RUN apt-get update && apt-get install -y --no-install-recommends \
-software-properties-common
+# Requirements for ROCm
+RUN apt -y install cmake mesa-common-dev libgflags-dev libgoogle-glog-dev

-# Ubuntu 16.04 does not have a python package new enough for gem5, use a  
PPA

-RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update
+RUN git clone  
https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface.git &&\

+git -C /ROCT-Thunk-Interface/ checkout roc-4.0.x && \
+mkdir -p /ROCT-Thunk-Interface/build

-# Should be minimal needed packages
-RUN apt-get update && apt-get install -y --no-install-recommends \
-findutils \
-file \
-libunwind8 \
-libunwind-dev \
-pkg-config \
-build-essential \
-gcc-multilib \
-g++-multilib \
-git \
-ca-certificates \
-m4 \
-zlib1g \
-zlib1g-dev \
-libprotobuf-dev \
-protobuf-compiler \
-libprotoc-dev \
-libgoogle-perftools-dev \
-python-yaml \
-python3.9 \
-python3.9-dev \
-python3.9-distutils \
-wget \
-libpci3 \
-libelf1 \
-libelf-dev \
-cmake \
-openssl \
-libssl-dev \
-libboost-filesystem-dev \
-libboost-system-dev \
-libboost-dev \
-libpng12-dev \
-gdb
+WORKDIR /ROCT-Thunk-Interface/build
+RUN cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/rocm .. && \
+make -j$(nproc) && make install
+WORKDIR /

-# Use python 3.9 by default
-RUN update-alternatives --install /usr/bin/python3 python3  
/usr/bin/python3.9 1

+# There was no rocm-4.0.x tag at the time, there was even a github post
+# stating to use rocm-3.10.x
+RUN git clone https://github.com/RadeonOpenCompute/ROCR-Runtime.git && \
+git -C /ROCR-Runtime/ checkout rocm-3.10.x && \
+mkdir -p /ROCR-Runtime/src/build

-# Setuptools is needed for cmake for ROCm build. Install using pip.
-# Instructions to install PIP from https://pypi.org/project/pip/
-RUN wget https://bootstrap.pypa.io/get-pip.py -qO get-pip.py
-RUN python3 get-pip.py
-RUN pip install -U setuptools scons==3.1.2 six
+WORKDIR /ROCR-Runtime/src/build
+# need MEMFD_CREATE=OFF as MEMFD_CREATE syscall isn't implemented
+RUN cmake -DIMAGE_SUPPORT=OFF -DHAVE_MEMFD_CREATE=OFF  
-DCMAKE_BUILD_TYPE=Debug\

+

[gem5-dev] Change in gem5/gem5[develop]: configs,gpu-compute: Add render driver needed for ROCm 4

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46244 )



Change subject: configs,gpu-compute: Add render driver needed for ROCm 4
..

configs,gpu-compute: Add render driver needed for ROCm 4

ROCm 4 utilizes the render driver located at /dev/dri/renderDXXX. This
patch implements a very simple driver that just returns a file
descriptor when opened, as testing has shown that's all that's needed

Change-Id: I65602346cbf17b2dc80e114046ebf5c9830a1507
---
M configs/example/apu_se.py
M configs/example/hsaTopology.py
M src/gpu-compute/GPU.py
M src/gpu-compute/SConscript
A src/gpu-compute/gpu_render_driver.cc
A src/gpu-compute/gpu_render_driver.hh
6 files changed, 49 insertions(+), 1 deletion(-)



diff --git a/configs/example/apu_se.py b/configs/example/apu_se.py
index f779df3..b9e1e7c 100644
--- a/configs/example/apu_se.py
+++ b/configs/example/apu_se.py
@@ -436,6 +436,8 @@
   gfxVersion = args.gfx_version,
   dGPUPoolID = 1, m_type = args.m_type)

+render_driver = GPURenderDriver(filename = 'dri/renderD128')
+
 # Creating the GPU kernel launching components: that is the HSA
 # packet processor (HSAPP), GPU command processor (CP), and the
 # dispatcher.
@@ -498,7 +500,8 @@
"HSA_ENABLE_SDMA=0"]

 process = Process(executable = executable, cmd = [args.cmd]
-  + args.options.split(), drivers = [gpu_driver], env =  
env)

+  + args.options.split(),
+  drivers = [gpu_driver, render_driver], env = env)

 for cpu in cpu_list:
 cpu.createThreads()
diff --git a/configs/example/hsaTopology.py b/configs/example/hsaTopology.py
index 78fe1f7..b77d1c1 100644
--- a/configs/example/hsaTopology.py
+++ b/configs/example/hsaTopology.py
@@ -373,6 +373,7 @@
 'vendor_id  
4098\n'  + \
 'device_id  
29440\n' + \
 'location_id  
512\n' + \
+'drm_render_minor  
128\n'+ \
 'max_engine_clk_fcompute %s\n' 
\
 % int(toFrequency(options.gpu_clock) /  
1e6) + \
 'local_mem_size  
4294967296\n'   + \

@@ -446,6 +447,7 @@
 'vendor_id  
4098\n'  + \
 'device_id  
39028\n' + \
 'location_id  
8\n'   + \
+'drm_render_minor  
128\n'+ \
 'max_engine_clk_fcompute %s\n' 
\
 % int(toFrequency(options.gpu_clock) /  
1e6) + \
 'local_mem_size  
0\n'+ \

diff --git a/src/gpu-compute/GPU.py b/src/gpu-compute/GPU.py
index 579c84b..ace83a5 100644
--- a/src/gpu-compute/GPU.py
+++ b/src/gpu-compute/GPU.py
@@ -254,6 +254,10 @@
 # default value: 5/C_RO_S (only allow caching in GL2 for read. Shared)
 m_type = Param.Int("Default MTYPE for cache. Valid values between  
0-7");


+class GPURenderDriver(EmulatedDriver):
+type = 'GPURenderDriver'
+cxx_header = 'gpu-compute/gpu_render_driver.hh'
+
 class GPUDispatcher(SimObject):
 type = 'GPUDispatcher'
 cxx_header = 'gpu-compute/dispatcher.hh'
diff --git a/src/gpu-compute/SConscript b/src/gpu-compute/SConscript
index adb9b0e..ae0bfab 100644
--- a/src/gpu-compute/SConscript
+++ b/src/gpu-compute/SConscript
@@ -52,6 +52,7 @@
 Source('gpu_compute_driver.cc')
 Source('gpu_dyn_inst.cc')
 Source('gpu_exec_context.cc')
+Source('gpu_render_driver.cc')
 Source('gpu_static_inst.cc')
 Source('gpu_tlb.cc')
 Source('lds_state.cc')
diff --git a/src/gpu-compute/gpu_render_driver.cc  
b/src/gpu-compute/gpu_render_driver.cc

new file mode 100644
index 000..9d9cbd2
--- /dev/null
+++ b/src/gpu-compute/gpu_render_driver.cc
@@ -0,0 +1,17 @@
+#include "gpu-compute/gpu_render_driver.hh"
+
+#include "params/GPURenderDriver.hh"
+#include "sim/fd_entry.hh"
+
+GPURenderDriver::GPURenderDriver(const GPURenderDriverParams )
+: EmulatedDriver(p)
+{
+}
+
+int GPURenderDriver::open(ThreadContext *tc, int mode, int flags)
+{
+auto process = tc->getProcessPtr();
+auto device_fd_entry = std::make_shared(this, filename);
+int tgt_fd = process->fds->allocFD(device_fd_entry);
+return tgt_fd;
+}
diff --git a/src/gpu-compute/gpu_render_driver.hh  
b/src/gpu-compute/gpu_render_driver.hh

new file mode 100644
index 000..46d1b8d
--- /dev/null
+++ b/src/gpu-compute/gpu_render_driver.hh
@@ -0,0 +1,21 @@
+#ifndef __GPU_COMPUTE_GPU_RENDER_DRIVER_HH__
+#define 

[gem5-dev] Change in gem5/gem5[develop]: configs: Add mem_banks to Carrizo topology

2021-05-30 Thread Kyle Roarty (Gerrit) via gem5-dev
Kyle Roarty has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/46240 )



Change subject: configs: Add mem_banks to Carrizo topology
..

configs: Add mem_banks to Carrizo topology

ROCm 4 iterates through the mem_banks to find an appropriate place to
allocate memory. Previously, Carrizo didn't have any mem_banks, which
resulted in the ROCm 4 runtime erroring out, as it didn't know where to
allocate memory.

The implementation is fairly similar to the implementation used for the
Fiji or Vega configs

Change-Id: I5bb4e89657d44c6cb690fd224ee1bf1d4d6cf2a5
---
M configs/example/hsaTopology.py
1 file changed, 15 insertions(+), 2 deletions(-)



diff --git a/configs/example/hsaTopology.py b/configs/example/hsaTopology.py
index 51585de..78fe1f7 100644
--- a/configs/example/hsaTopology.py
+++ b/configs/example/hsaTopology.py
@@ -36,7 +36,7 @@
 from os.path import join as joinpath
 from os.path import isdir
 from shutil import rmtree, copyfile
-from m5.util.convert import toFrequency
+from m5.util.convert import toFrequency, toMemorySize

 def file_append(path, contents):
 with open(joinpath(*path), 'a') as f:
@@ -422,12 +422,14 @@
 # must have marketing name
 file_append((node_dir, 'name'), 'Carrizo\n')

+mem_banks_cnt = 1
+
 # populate global node properties
 # NOTE: SIMD count triggers a valid GPU agent creation
 node_prop = 'cpu_cores_count %s\n' %  
options.num_cpus   + \
 'simd_count %s\n'  
\
 % (options.num_compute_units *  
options.simds_per_cu)+ \
-'mem_banks_count  
0\n'   + \
+'mem_banks_count %s\n' %  
mem_banks_cnt  + \
 'caches_count  
0\n'  + \
 'io_links_count  
0\n'+ \
 'cpu_core_id_base  
16\n' + \

@@ -453,3 +455,14 @@
 % int(toFrequency(options.CPUClock) / 1e6)

 file_append((node_dir, 'properties'), node_prop)
+
+for i in range(mem_banks_cnt):
+mem_dir = joinpath(node_dir, f'mem_banks/{i}')
+remake_dir(mem_dir)
+
+mem_prop = f'heap_type  
0\n' + \
+   f'size_in_bytes  
{toMemorySize(options.mem_size)}'+ \
+   f'flags  
0\n' + \
+   f'width  
64\n'+ \

+   f'mem_clk_max 1600\n'
+file_append((mem_dir, 'properties'), mem_prop)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46240
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5bb4e89657d44c6cb690fd224ee1bf1d4d6cf2a5
Gerrit-Change-Number: 46240
Gerrit-PatchSet: 1
Gerrit-Owner: Kyle Roarty 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Build failed in Jenkins: compiler-checks #78

2021-05-30 Thread jenkins-no-reply--- via gem5-dev
See 


Changes:

[odanrc] mem-cache: Rename Compressor namespace as compression

[odanrc] mem-cache: Rename encoder variables as indexEncoder

[odanrc] mem-cache: Rename Encoder namespace as encoder

[gabe.black] arch-riscv: Split up read/write and read only CSR instructions.

[gabe.black] arch,base,cpu: Split arch/pcstate.hh out of arch/types.hh.

[gabe.black] misc: Clean up ISA switching header includes.

[gabe.black] x86: Avoid including arch/x86/registers.hh.

[gabe.black] cpu,fastmodel: Get rid of the unused ThreadContext::getPhysProxy.

[gabe.black] sim: Make PortProxy args in BaseBufferArg const ref.

[odanrc] mem-cache: Rename Prefetcher namespace as prefetch

[odanrc] cpu,mem: Rename ContextSwitchTaskId namespace

[odanrc] sim: Rename ProbePoints namespace as probing

[odanrc] base,dev,python: Rename Net namespace as networking

[odanrc] misc: Rename Enums namespace as enums

[odanrc] base,dev: Rename major and minor variables

[odanrc] base,dev,mem-ruby: Rename m5 namespace as gem5

[odanrc] base: Rename Loader namespace as loader

[odanrc] cpu-minor: Rename Minor namespace as minor

[odanrc] base-stats,misc: Rename Stats namespace as statistics

[odanrc] mem: Rename "memory" variables as "mem"


--
Started by timer
Running as SYSTEM
Building in workspace 
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir 
 >  # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://gem5.googlesource.com/public/gem5 # 
 > timeout=10
Fetching upstream changes from https://gem5.googlesource.com/public/gem5
 > git --version # timeout=10
 > git --version # 'git version 2.25.1'
 > git fetch --tags --force --progress -- 
 > https://gem5.googlesource.com/public/gem5 
 > +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
Checking out Revision 93e57346851ade94605d2d1cb3bf90cdb935deda 
(refs/remotes/origin/develop)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 93e57346851ade94605d2d1cb3bf90cdb935deda # timeout=10
Commit message: "mem: Rename "memory" variables as "mem""
 > git rev-list --no-walk d9bda9c2be4e27d6d985268b47a8ec48d3c1a687 # timeout=10
[compiler-checks] $ /bin/sh -xe /tmp/jenkins6021685268204653228.sh
+ ./util/compiler-tests.sh -j 12
Starting build tests with 'gcc-version-10'...
'gcc-version-10' was found in the comprehensive tests. All ISAs will be built.
  * Building target 'SPARC.opt' with 'gcc-version-10'...
Done.
  * Building target 'SPARC.fast' with 'gcc-version-10'...
Done.
  * Building target 'X86.opt' with 'gcc-version-10'...
Done.
  * Building target 'X86.fast' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MESI_Two_Level.opt' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MESI_Two_Level.fast' with 'gcc-version-10'...
Done.
  * Building target 'Garnet_standalone.opt' with 'gcc-version-10'...
Done.
  * Building target 'Garnet_standalone.fast' with 'gcc-version-10'...
Done.
  * Building target 'ARM.opt' with 'gcc-version-10'...
Done.
  * Building target 'ARM.fast' with 'gcc-version-10'...
Done.
  * Building target 'X86_MOESI_AMD_Base.opt' with 'gcc-version-10'...
Done.
  * Building target 'X86_MOESI_AMD_Base.fast' with 'gcc-version-10'...
Done.
  * Building target 'POWER.opt' with 'gcc-version-10'...
Done.
  * Building target 'POWER.fast' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MOESI_CMP_token.opt' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MOESI_CMP_token.fast' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MOESI_CMP_directory.opt' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MOESI_CMP_directory.fast' with 'gcc-version-10'...
Done.
  * Building target 'RISCV.opt' with 'gcc-version-10'...
Done.
  * Building target 'RISCV.fast' with 'gcc-version-10'...
Done.
  * Building target 'MIPS.opt' with 'gcc-version-10'...
Done.
  * Building target 'MIPS.fast' with 'gcc-version-10'...
Done.
  * Building target 'GCN3_X86.opt' with 'gcc-version-10'...
Done.
  * Building target 'GCN3_X86.fast' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MOESI_hammer.opt' with 'gcc-version-10'...
Done.
  * Building target 'NULL_MOESI_hammer.fast' with 'gcc-version-10'...
Done.
  * Building target 'ARM_MESI_Three_Level.opt' with 'gcc-version-10'...
Done.
  * Building target 'ARM_MESI_Three_Level.fast' with 'gcc-version-10'...
Done.
Starting build tests with 'gcc-version-9'...
  * Building target 'NULL_MESI_Two_Level.opt' with 'gcc-version-9'...
Done.
  * Building target