Severe performance regression in OpenMP offloading Fortran codes with driver version 590

Hi Mat,

This thread might well be in the wrong forum section, so please feel free to move it if needed. Unfortunately, this time I don’t have a minimal reproducible example, so I’ll try to explain what is happening as best as I can.

We have this Fortran code that uses OpenMP offloading and managed memory. With driver versions 590.44.01 and 590.48.01, its performance is more than 3x worse than it was with version 580.105.08. This is fully reproducible: I can, while using the exact same machine and binary, upgrade to 590.48.01 with the expected performance hit and rollback to 580.105.08 (without changing anything else) to regain performance. I’ve noticed that the number of unified memory copies - especially from device to host - has increased dramatically, though, interestingly, the total size of moved data actually (slightly) decreases with the newer driver.

580.105.08:

 ** CUDA GPU MemOps Summary (by Time) (cuda_gpu_mem_time_sum):

 Time (%)  Total Time (ns)   Count   Avg (ns)  Med (ns)  Min (ns)  Max (ns)  StdDev (ns)               Operation              
 --------  ---------------  -------  --------  --------  --------  --------  -----------  ------------------------------------
     60.6    2,233,133,820  858,153   2,602.3   2,111.0     1,951   102,944      2,087.9  [CUDA memcpy Unified Host-to-Device]
     24.6      905,466,170  203,701   4,445.1   2,431.0     1,791    36,352      4,583.6  [CUDA memcpy Unified Device-to-Host]
      7.8      286,461,272  317,236     903.0     896.0       800     2,976         65.7  [CUDA memcpy Host-to-Device]        
      7.1      262,724,932  127,246   2,064.7   2,080.0     1,601     3,713         80.4  [CUDA memcpy Device-to-Host]        
      0.0            1,664        2     832.0     832.0       800       864         45.3  [CUDA memset]

 ** CUDA GPU MemOps Summary (by Size) (cuda_gpu_mem_size_sum):

 Total (MB)   Count   Avg (MB)  Med (MB)  Min (MB)  Max (MB)  StdDev (MB)               Operation              
 ----------  -------  --------  --------  --------  --------  -----------  ------------------------------------
 28,124.111  858,153     0.033     0.008     0.004     1.044        0.086  [CUDA memcpy Unified Host-to-Device]
 24,682.500  203,701     0.121     0.004     0.004     1.044        0.240  [CUDA memcpy Unified Device-to-Host]
    196.298  317,236     0.001     0.000     0.000     0.031        0.001  [CUDA memcpy Host-to-Device]        
    156.386  127,246     0.001     0.002     0.000     0.031        0.001  [CUDA memcpy Device-to-Host]        
      0.000        2     0.000     0.000     0.000     0.000        0.000  [CUDA memset] 

 ** OS Runtime Summary (osrt_sum):

 Time (%)  Total Time (ns)  Num Calls     Avg (ns)         Med (ns)        Min (ns)       Max (ns)     StdDev (ns)            Name         
 --------  ---------------  ---------  ---------------  ---------------  -------------  -------------  ------------  ----------------------
     63.9   38,052,444,945      2,010     18,931,564.6     10,066,212.0          1,000    132,625,963  27,797,520.2  poll                  
     33.6   20,000,386,527          5  4,000,077,305.4  4,000,082,735.0  4,000,050,875  4,000,087,666      14,964.6  pthread_cond_timedwait
      1.8    1,083,504,024         75     14,446,720.3     17,281,522.0          1,030     29,850,115  13,174,035.7  pthread_mutex_lock

 ** CUDA API Summary (cuda_api_sum):

 Time (%)  Total Time (ns)  Num Calls    Avg (ns)      Med (ns)     Min (ns)    Max (ns)   StdDev (ns)          Name        
 --------  ---------------  ---------  ------------  ------------  ----------  ----------  -----------  --------------------
     54.2    4,397,323,702    146,172      30,083.2       1,290.0       1,080  46,908,555    721,274.2  cuStreamSynchronize 
     34.0    2,763,496,327    127,246      21,717.7       8,930.0       8,110   7,592,592    163,780.6  cuMemcpyDtoHAsync_v2
      7.1      580,236,577    317,236       1,829.0       1,740.0       1,350     117,571        751.2  cuMemcpyHtoDAsync_v2
      4.0      328,275,778    146,172       2,245.8       2,110.0       1,630     131,051        894.7  cuLaunchKernel

590.48.01:

 ** CUDA GPU MemOps Summary (by Time) (cuda_gpu_mem_time_sum):

 Time (%)  Total Time (ns)    Count    Avg (ns)  Med (ns)  Min (ns)  Max (ns)  StdDev (ns)               Operation              
 --------  ---------------  ---------  --------  --------  --------  --------  -----------  ------------------------------------
     47.6    2,959,088,626  1,203,472   2,458.8   2,144.0     1,664    34,624      1,803.3  [CUDA memcpy Unified Device-to-Host]
     43.6    2,710,120,248  1,095,510   2,473.8   2,111.0     1,951    86,016      1,799.5  [CUDA memcpy Unified Host-to-Device]
      4.6      286,505,898    317,236     903.1     896.0       800     2,816         65.8  [CUDA memcpy Host-to-Device]        
      4.2      263,187,667    127,246   2,068.3   2,080.0     1,632     3,936         85.4  [CUDA memcpy Device-to-Host]        
      0.0            1,664          2     832.0     832.0       800       864         45.3  [CUDA memset] 

 ** CUDA GPU MemOps Summary (by Size) (cuda_gpu_mem_size_sum):

 Total (MB)    Count    Avg (MB)  Med (MB)  Min (MB)  Max (MB)  StdDev (MB)               Operation              
 ----------  ---------  --------  --------  --------  --------  -----------  ------------------------------------
 27,319.493  1,095,510     0.025     0.008     0.004     1.044        0.073  [CUDA memcpy Unified Host-to-Device]
 23,706.038  1,203,472     0.020     0.004     0.004     1.044        0.099  [CUDA memcpy Unified Device-to-Host]
    196.298    317,236     0.001     0.000     0.000     0.031        0.001  [CUDA memcpy Host-to-Device]        
    156.386    127,246     0.001     0.002     0.000     0.031        0.001  [CUDA memcpy Device-to-Host]        
      0.000          2     0.000     0.000     0.000     0.000        0.000  [CUDA memset]   

 ** OS Runtime Summary (osrt_sum):

 Time (%)  Total Time (ns)  Num Calls     Avg (ns)         Med (ns)        Min (ns)       Max (ns)     StdDev (ns)            Name         
 --------  ---------------  ---------  ---------------  ---------------  -------------  -------------  ------------  ----------------------
     73.9  196,954,899,272      7,349     26,800,231.2     10,066,376.0          1,020    106,505,496  35,510,825.6  poll                  
     25.5   68,001,308,749         17  4,000,076,985.2  4,000,075,087.0  4,000,045,466  4,000,098,837      12,827.9  pthread_cond_timedwait
      0.4    1,116,295,844         81     13,781,430.2     13,668,450.0          1,010     31,144,623  13,067,462.0  pthread_mutex_lock

 ** CUDA API Summary (cuda_api_sum):

 Time (%)  Total Time (ns)  Num Calls    Avg (ns)      Med (ns)     Min (ns)    Max (ns)   StdDev (ns)          Name        
 --------  ---------------  ---------  ------------  ------------  ----------  ----------  -----------  --------------------
     50.4    5,256,400,779    146,172      35,960.4       1,290.0       1,080  82,768,070    839,761.3  cuStreamSynchronize 
     40.4    4,211,911,778    127,246      33,100.5       8,900.0       8,120  53,519,053    323,280.1  cuMemcpyDtoHAsync_v2
      5.6      584,016,632    317,236       1,841.0       1,760.0       1,370     134,121        762.6  cuMemcpyHtoDAsync_v2
      3.2      334,288,149    146,172       2,287.0       2,150.0       1,700     130,070        971.0  cuLaunchKernel

Let me know if you need any more information.

Hi Nuno,

Which compiler version are you using? We didn’t add support for CUDA 13 until the 25.9 release and CUDA 13.1 until 25.11.

I’m just guessing, but if you were using an earlier compiler, then you’d be linking with the CUDA 12 libraries which may not be optimized for the CUDA 13.1 drivers.

It tried one of my more memory intensive benchmarks on a system with a 590.44.01 driver. With 25.7, my time was 105 seconds versus 30 seconds with 25.9. However on a near identical system with a 580.82.07 driver, I see a similar difference, 96 secs vs 30 seconds. So it doesn’t quite fit your example.

-Mat

I’m already using 25.11 unfortunately.

I’ve edited my original post with the information I gathered from profiling the code with both driver versions. I have also now run the code with NVCOMPILER_ACC_NOTIFY=2 with both drivers and there is no difference in the reported transfers at the application level. My conclusion is, therefore, that the driver is making different choices on how many pages it is moving at once, i.e. driver version 590 is making more memory transfers of smaller size: more latency, less bandwidth.

Can I ask that we try to confirm with the engineering team if this could be the case and if there’s any (perhaps hidden/undocumented) option or environment variable I can change to restore the old behaviour?

Cheers and Merry Christmas,
-Nuno

Even though I can’t reproduce this, the profile suggests that it is indeed increased Unified memory movement that’s the cause (in particular device-to-host).

From the compiler perspective, let’s try adjusting how the cuMemAdvise call are used by using the environment variable “NVCOMPILER_ACC_MEMHINTS”. It has three options:

  • DISABLE: Memory hints are disabled for all data constructs.
  • ENABLE_EXPLICIT: Memory hints are enabled for explicit data constructs only.
  • ENABLE_ALL: Memory hints are enabled for explicit and implicit data constructs.

“ENABLE_EXPLCIT” is the default so no need test it, but I’m curious if DISABLE has any effect. I would expect things to slow down but more looking to see if you get more consistent results between the two drivers.

There’s also tow other environment variables we can try:

“NVCOMPILER_ACC_MEMPREFETCH” which controls unified memory prefetching, but only when data directives are used.
“NVCOMPILER_ACC_UNIFED_ALLOC_MODE” which controls where managed memory is allocated.

I don’t think either would have any impact here, but possible.

For details see: NVIDIA HPC Compilers User's Guide — NVIDIA HPC Compilers User's Guide 25.11 documentation

-Mat

Hi Mat,

Just to let you know I’m not ignoring you. I think I’ll wait for the next driver release to have a better excuse to steal the system from users for a day or so. It was easy to justify the downtime on the run-up to Christmas, but it’s a bit harder now.

I will say I did try a number of environment variables, and I recall that everything that I tried just made it slower. But I didn’t compare across drivers, so I cannot comment on consistency, unfortunately.

I also noticed that NVCOMPILER_ACC_UNIFED_ALLOC_MODE was misspelled in the docs, so I also remember setting two versions of that variable, with and without the spelling mistake, to make sure I was getting the desired effect. Hopefully, you can still report to the team in time for 26.1.

Cheers,
-Nuno

Thanks! I let our docs folks know.

I think I’ll wait for the next driver release to have a better excuse to steal the system from users for a day or so.

Sounds good. It does seem like a driver issue, though since I can’t reproduce it (at least not the same as you), I can’t be sure.

Update:

  • the issue persists, as expected, with version 26.1 of the SDK
  • driver version 580.126.16 released today is unaffected
  • setting NVCOMPILER_ACC_MEMHINTS to EXPLICIT_ALL slows down execution slightly, but the massive gap remains (also note I’m using an H200 NVL and that there are no explicit data constructs)
  • some big changes happened to UVM in 590.44.01 · NVIDIA/open-gpu-kernel-modules@a5bfb10 · GitHub, but with one big monolithic commit, finding the issue isn’t easy
  • here’s some new data on page faults:

580.126.16:

 ** Unified Memory Totals Summary (um_total_sum):

 Total HtoD Migration Size (MB)  Total DtoH Migration Size (MB)  Total CPU Page Faults  Total GPU PageFaults  Minimum Virtual Address  Maximum Virtual Address
 ------------------------------  ------------------------------  ---------------------  --------------------  -----------------------  -----------------------
                     25,890.185                      24,754.131                109,889               404,543  0x7FD6EC000000           0x7FDB4B700000

590.48.01:

 ** Unified Memory Totals Summary (um_total_sum):

 Total HtoD Migration Size (MB)  Total DtoH Migration Size (MB)  Total CPU Page Faults  Total GPU PageFaults  Minimum Virtual Address  Maximum Virtual Address
 ------------------------------  ------------------------------  ---------------------  --------------------  -----------------------  -----------------------
                     25,483.256                      23,720.239              1,139,972               932,954  0x7FBF7C000000           0x7FC3DD700000

Have you dug into this using nsight systems profiles? The visualization of when specific things are happening and where in your program may help highlight the change in behavior and let you carve out smaller and easier to understand examples.

Not sure I can be anymore help than Mat has been so far, just spitballing since I’m watching the forum for the week.

Small update to report that 580.126.20 is also unaffected.

Unfortunately, the issue persists with 595.58.03. Using version 26.3 of the SDK makes no difference. I’ll try to build you guys a script so you can reproduce on your end, though it’d be nice if issues like these got reported to the engineering team even without a reproducer.

I switched to the open kernel modules yesterday, but that made no difference either.

Understood, but when I tried earlier, I couldn’t reproduce the same issue with my codes. That’s why are reproducer would be very helpful. Then I know I have the same binary as you and can try various drivers to see if it still reproduces. If it doesn’t then there may be something else going on with your system, exactly what I have no idea and it’s not my area of expertise, but at least it’s a starting point for me to ask.

Hi Mat,

Let’s try running NEMO. We’ve managed to come up with a configuration which is fully open and that reproduces the problem on our machine.
Relevant specs:

Red Hat Enterprise Linux 10.1 (Coughlan)
Linux 6.12.0-124.49.1.el10_1.x86_64
Supermicro H14DSG-O-CPU
2x AMD EPYC 9175F 16-Core Processor               
2x NVIDIA H200 NVL

The following will download all of NEMO’s dependencies (get_nemo.sh is a bit overzealous, it even downloads Python…!) and compile and run NEMO (back-to-back runs of run_nemo.sh will not recompile, just execute the existing binary):

git clone https://github.com/nmnobre/PSyclone-NEMO.git
cd PSyclone-NEMO
./get_nemo.sh
./run_nemo.sh

On our machine, with driver version 580.126.20, the reported execution time is under 8s, whereas with driver version 595.58.03, it rises to just below 13s.

-Nuno

Hi Nuno,

I tried to build from your script over the weekend but encountered issues. We also have NEMO in our QA system, so I’ve asked Seth to take a looks since he’s more familiar with NEMO than I am. We also have another engineer in mind who’s good at tracking these types of issue down.

Might be a bit, but we’re trying.

-Mat

Hi Nuno,

I was able to pull down and build using your scripts. However, I think the most helpful thing you could provide us is nsight system reports run on the 580 driver and 590 driver tracing cuda on your machines. I can generate that on our own machines, but we don’t have the capability to change the driver on the same machine. I think, so it might not be a true apple to apple comparison.

I generated a snippet of a profile on a 580.65.06 driver, which I think should be a good version, and I essentially see page faults throughout the entire run (red marks during kernels, and sometimes after the kernel if something needs to page fault back to the CPU), as well as a lot of general data movement before and after each kernel launch -

So, to me, the performance slowdown is probably just more page faults, or more variables page-faulting. For example, I identified a huge difference in behavior on our machines looking at the last kernel of the tra_adv_mus_t subroutine. That kernel is interesting because it’s essentially a do loop calling the same kernel repeatedly. On the 580 machine, we get page faulting two or three times, and then the data settles down onto the GPU for the following several calls. Whereas with the 590 machine, it never appears to settle down.

580 - 28 calls to line 342 of that tra_adv_mus_t subroutine - it looks like 6 page fault, and the rest are clean:

590 - 28 calls to the same kernel, all of the calls page fault, greatly increasing run time:

I’d like to see that you see the same exact behavior change in your code, and if you could identify a few more kernels explicitly that this change occurs for. Assuming your experience lines up with what I’m seeing, I’m going to open an issue and assign it to someone to dig into further and try to understand exactly why it’s happening and what changed.

It could be that certain hints are being ignored by the driver, or haven’t been fully implemented for OpenMP. I’m not sure. We’ll work on getting to the bottom of it though.

I opened an issue 38473 to cover this and asked two of my colleagues to take a look. Any updates you provide, I’ll gladly relay to them.

Hi,

Thanks for having a go! Your finding match ours exactly. I’ll DM you two profiles collected on our machine for driver versions 580.126.20 and 595.58.03. What hardware did you test this on?

Cheers,
-Nuno

I tested on a genoa with a H200 NVL on it for a 580 driver, and a haswell with an ada on it for the 590 driver. It’s definitely not a 1 to 1 comparison, by any means, but I just wanted to see the behavior of the kernels and data movement and to stay on x86, since that’s what your reproducer had. Seeing agreement with your observations makes me feel justified in those life decisions, haha.

I’ll take a look at the profiles you sent and also share them with the people working on the issue.

That’s great, it shows that the performance impact is not limited to the H200 NVL or to the Hopper architecture.