[libgomp, nvptx] Remove hard-coded const in nvptx_open_device
authorTom de Vries <tdevries@suse.de>
Wed, 8 Aug 2018 14:26:19 +0000 (14:26 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Wed, 8 Aug 2018 14:26:19 +0000 (14:26 +0000)
commitb113af959cc00dd8726298003e837b5824288649
tree6f046c7dfeb9031d0554fb3b7834326cf89427f1
parent94767dacea8098464a6b23c74bb5768449c6443c
[libgomp, nvptx] Remove hard-coded const in nvptx_open_device

CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR is defined in cuda driver
api version 6.0 and higher.

Currently nvptx_open_device uses a hard-coded constant instead.

This patch fixes that by:
- defining CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR to the hardcoded
  constant at toplevel, if not present in cuda.h, and
- using CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR in nvptx_open_device

Build on x86_64 with nvptx accelerator and reg-tested libgomp.

2018-08-08  Tom de Vries  <tdevries@suse.de>

* plugin/plugin-nvptx.c
(CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR): Define.
(nvptx_open_device): Use
CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR.

From-SVN: r263406
libgomp/ChangeLog
libgomp/plugin/plugin-nvptx.c