cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

develancer
Adept I

Wrong int64 multiplication on RX 5700 XT

[To moderator:] I didn't know whether I should post it here, or in the Support Forums → Graphics section, so please delete the one that does not fit.

AMD OpenCL compiler used for RX 5700 XT with ROCM 4.0.1 sometimes generates invalid code for integer multiplication.

The self-contained example is here: https://github.com/develancer/amd-opencl-test-case

My clinfo:

  Platform Name:				 AMD Accelerated Parallel Processing
Number of devices:				 1
  Device Type:					 CL_DEVICE_TYPE_GPU
  Vendor ID:					 1002h
  Board name:					 Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT]
  Device Topology:				 PCI[ B#11, D#0, F#0 ]
  Max compute units:				 20
  Max work items dimensions:			 3
    Max work items[0]:				 1024
    Max work items[1]:				 1024
    Max work items[2]:				 1024
  Max work group size:				 256
  Preferred vector width char:			 4
  Preferred vector width short:			 2
  Preferred vector width int:			 1
  Preferred vector width long:			 1
  Preferred vector width float:			 1
  Preferred vector width double:		 1
  Native vector width char:			 4
  Native vector width short:			 2
  Native vector width int:			 1
  Native vector width long:			 1
  Native vector width float:			 1
  Native vector width double:			 1
  Max clock frequency:				 2200Mhz
  Address bits:					 64
  Max memory allocation:			 7287183768
  Image support:				 Yes
  Max number of images read arguments:		 128
  Max number of images write arguments:		 8
  Max image 2D width:				 16384
  Max image 2D height:				 16384
  Max image 3D width:				 16384
  Max image 3D height:				 16384
  Max image 3D depth:				 8192
  Max samplers within kernel:			 29471
  Max size of kernel argument:			 1024
  Alignment (bits) of base address:		 1024
  Minimum alignment (bytes) for any datatype:	 128
  Single precision floating point capability
    Denorms:					 Yes
    Quiet NaNs:					 Yes
    Round to nearest even:			 Yes
    Round to zero:				 Yes
    Round to +ve and infinity:			 Yes
    IEEE754-2008 fused multiply-add:		 Yes
  Cache type:					 Read/Write
  Cache line size:				 64
  Cache size:					 16384
  Global memory size:				 8573157376
  Constant buffer size:				 7287183768
  Max number of constant args:			 8
  Local memory type:				 Scratchpad
  Local memory size:				 65536
  Max pipe arguments:				 16
  Max pipe active reservations:			 16
  Max pipe packet size:				 2992216472
  Max global variable size:			 7287183768
  Max global variable preferred total size:	 8573157376
  Max read/write image args:			 64
  Max on device events:				 1024
  Queue on device max size:			 8388608
  Max on device queues:				 1
  Queue on device preferred size:		 262144
  SVM capabilities:				 
    Coarse grain buffer:			 Yes
    Fine grain buffer:				 Yes
    Fine grain system:				 No
    Atomics:					 No
  Preferred platform atomic alignment:		 0
  Preferred global atomic alignment:		 0
  Preferred local atomic alignment:		 0
  Kernel Preferred work group size multiple:	 32
  Error correction support:			 0
  Unified memory for Host and Device:		 0
  Profiling timer resolution:			 1
  Device endianess:				 Little
  Available:					 Yes
  Compiler available:				 Yes
  Execution capabilities:				 
    Execute OpenCL kernels:			 Yes
    Execute native function:			 No
  Queue on Host properties:				 
    Out-of-Order:				 No
    Profiling :					 Yes
  Queue on Device properties:				 
    Out-of-Order:				 Yes
    Profiling :					 Yes
  Platform ID:					 0x7f65a6148cf0
  Name:						 gfx1010
  Vendor:					 Advanced Micro Devices, Inc.
  Device OpenCL C version:			 OpenCL C 2.0 
  Driver version:				 3212.0 (HSA1.1,LC)
  Profile:					 FULL_PROFILE
  Version:					 OpenCL 2.0 
  Extensions:					 cl_khr_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_media_ops cl_amd_media_ops2 cl_khr_image2d_from_buffer cl_khr_subgroups cl_khr_depth_images cl_amd_copy_buffer_p2p cl_amd_assembly_program

 

0 Likes
Reply
14 Replies
dipak
Staff
Staff

Re: Wrong int64 multiplication on RX 5700 XT

Hi @develancer ,

I've whitelisted you and moved the post to "AMD OpenCL" forum.

 

Thanks.

0 Likes
Reply
dipak
Staff
Staff

Re: Wrong int64 multiplication on RX 5700 XT

Could you please build the kernel without optimization (i.e. set optimization flag " -cl-opt-disable" or "-O0" to clBuildProgram) to see if it produces correct result?

 

Thanks.

0 Likes
Reply
develancer
Adept I

Re: Wrong int64 multiplication on RX 5700 XT

  • -cl-opt-disable: correct
  • -O0: correct
  • -O1: correct
  • -O2: incorrect
0 Likes
Reply
dipak
Staff
Staff

Re: Wrong int64 multiplication on RX 5700 XT

Thank you for the information. It seems to be a compiler optimization issue. I'll report it to the OpenCL team.

 

P.S. For ROCm related support, you may post your query or issue at its GitHub site here: https://github.com/RadeonOpenCompute/ROCm/issues

 

Thanks.

0 Likes
Reply
colesdav
MVP

Re: Wrong int64 multiplication on RX 5700 XT

Hope you havn't been using your AMD GPU for anything genetic engineering related...

0 Likes
Reply
develancer
Adept I

Re: Wrong int64 multiplication on RX 5700 XT

@dipak  I don't think it's ROCm-related, as I've had exactly same issues with pure AMDGPU-PRO drivers.

Can you link me somehow to this internal bug report?

I also have another issue in my main program resulting in errors also in -O0 mode. I'll try to extract it and submit.

0 Likes
Reply
develancer
Adept I

Re: Wrong int64 multiplication on RX 5700 XT

@dipakI have just updated the test case and now it produces incorrect results also with all optimizations disabled!

The previous version of the test case is now on branch “previous”.

0 Likes
Reply
dipak
Staff
Staff

Re: Wrong int64 multiplication on RX 5700 XT


@develancer wrote:

I don't think it's ROCm-related, as I've had exactly same issues with pure AMDGPU-PRO drivers.

It mainly depends on the compiler and, I think, in this case the compiler toolchain is same for both the drivers. 

By the way, I just ran the latest code on Win10 with a Vega card and I observed correct result for both cases i.e. "with and without optimization". 

 


@develancer wrote:

Can you link me somehow to this internal bug report?


The bug tracking system is for internal use. We will let you know if there is any update on this issue.

 

Thanks.

 

0 Likes
Reply
develancer
Adept I

Re: Wrong int64 multiplication on RX 5700 XT

@dipakOne last question:

Should I also report this bug on the ROCm's github? Would it help in fixing it?

PS. (unrelated)
Who should I write to if I don't receive my forum verification e-mail despite trying multiple times?

0 Likes
Reply