Driver 580.159.03 changes main-thread CPU affinity to 4 CPUs on AWS g5 / AMD EPYC 7R32

Hi,

After moving from the Amazon Linux 2 ECS GPU-optimized AMI (driver 550) to the Amazon Linux 2023 ECS GPU-optimized AMI (driver 580.159.03), a Unity-based application using Vulkan started running as if the machine had only 4 CPUs. We traced the affinity change to the NVIDIA user-mode driver and would appreciate your help.

Summary

During graphics initialization, libnvidia-glcore changes the CPU affinity of the calling thread—the application’s main thread—to a small subset of CPUs. The application does not request this change. Threads subsequently created by that thread inherit the restricted mask, limiting CPU availability for affected thread pools.

Environment

  • AWS g5.8xlarge (32 vCPU) and g5.16xlarge (64 vCPU): NVIDIA A10G, AMD EPYC 7R32.

  • SMT sibling numbering: CPU n pairs with n+16 (32 vCPU) or n+32 (64 vCPU).

  • Affected:

    • Amazon Linux 2023 ECS GPU-optimized AMI: al2023-ami-ecs-gpu-hvm-2023.0.20260813-kernel-6.1-x86_64-ebs

    • Kernel: 6.1.177-224.371.amzn2023.x86_64

    • NVIDIA driver: 580.159.03 (open kernel module)

  • Unaffected:

    • Amazon Linux 2 ECS GPU-optimized AMI: amzn2-ami-ecs-gpu-hvm-2.0.20260525-x86_64-ebs

    • Kernel: 4.14.355-282.729.amzn2.x86_64

    • NVIDIA driver: 550.163.01 (proprietary kernel module)

  • Container: Ubuntu 24.04, using the same image on both hosts. NVIDIA user-mode libraries are injected by nvidia-container-toolkit.

  • Application: Unity 6000.3.13f1 player, Vulkan renderer only.

Observations (64-vCPU host)

  • The process starts with affinity 0-63. There is no cgroup cpuset restriction or CPU quota.

  • About 0.55 seconds after startup, the main thread’s affinity changes from 0-63 to 0,2,32,34. On 32-vCPU hosts, the resulting mask is 0,2,16,18.

  • This set matches the CPUs sharing CPU0’s L3 cache, restricted to even-numbered CPUs. With this SMT numbering, it covers only 2 physical cores.

  • strace -f -k shows the call originating in the driver:

    pthread_setaffinity_np (libc)
    libnvidia-glcore.so.580.159.03 + 0xa10657
    
  • libGLX_nvidia and libnvidia-glcore are loaded about 0.27 seconds after startup. The affinity change occurs at about 0.55 seconds, before the Vulkan loader (libvulkan.so.1) is loaded. This suggests it may be triggered by the GLX startup path rather than Vulkan device creation, although we have not confirmed this.

  • Setting __GL_THREADED_OPTIMIZATIONS=0 does not change the behavior.

  • With driver 550.163.01 on Amazon Linux 2, we do not observe any change to the main thread’s affinity.

Impact

In this application, Mono’s Environment.ProcessorCount reports only 4 CPUs on a 64-vCPU machine after the affinity change. This limits thread-pool concurrency and causes application timeouts.

The driver changes the affinity without an explicit request from the application.

Questions

  1. Is this affinity change intended? If so, what is it meant to optimize?

  2. Is there a supported way to disable it, such as an environment variable or application profile setting?

  3. Is this a known issue in 580.159.03? Has the behavior changed in 580.178.04 or the 590/595 branches?

  4. What could explain the difference between these two environments: the driver version, the open versus proprietary kernel module, or the CPU topology information exposed by the newer kernel? The OS, kernel, and driver changed together, so this comparison does not isolate a single cause.

We can provide nvidia-bug-report.log.gz from an affected host and a minimal standalone reproducer that does not require Unity. We are also happy to test candidate drivers or settings.

Thank you.

This is now fixed on drivers from our 595 series and above. Please let us know if this remains an issue on our latest drivers. Thank you