Fix NVML capability lookup for visible devices (#47892)