Exemplo n.º 1
0
        protected override IEnumerable <AmdGpuDevice> CreateGpuDevices(List <OpenCLDevice> amdDevices, Dictionary <string, bool> disableAlgos)
        {
            Helpers.ConsolePrint(Tag, "Using AMD device creation FALLBACK UnReliable mappings");

            // get video AMD controllers and sort them by RAM
            // (find a way to get PCI BUS Numbers from PNPDeviceID)
            var amdVideoControllers = SystemSpecs.AvailableVideoControllers.Where(vcd => vcd.IsAmd).ToList();

            // sort by ram not ideal
            amdVideoControllers.Sort((a, b) => (int)(a.AdapterRam - b.AdapterRam));
            amdDevices.Sort((a, b) =>
                            (int)(a._CL_DEVICE_GLOBAL_MEM_SIZE - b._CL_DEVICE_GLOBAL_MEM_SIZE));
            var minCount = Math.Min(amdVideoControllers.Count, amdDevices.Count);

            for (var i = 0; i < minCount; ++i)
            {
                var deviceName = amdVideoControllers[i].Name;
                amdVideoControllers[i].SetInfSectionEmptyIfNull();
                var newAmdDev = new AmdGpuDevice(amdDevices[i],
                                                 amdVideoControllers[i].InfSection,
                                                 disableAlgos[deviceName],
                                                 deviceName,
                                                 "UNUSED");

                yield return(newAmdDev);
            }
        }
Exemplo n.º 2
0
        private List <OpenCLDevice> AmdDeviceCreationPrimary(List <OpenCLDevice> amdDevices)
        {
            Helpers.ConsolePrint(Tag, "Using AMD device creation DEFAULT Reliable mappings");
            Helpers.ConsolePrint(Tag,
                                 amdDevices.Count == _amdDeviceUuid.Count
                    ? "AMD OpenCL and ADL AMD query COUNTS GOOD/SAME"
                    : "AMD OpenCL and ADL AMD query COUNTS DIFFERENT/BAD");
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("");
            stringBuilder.AppendLine("QueryAMD [DEFAULT query] devices: ");
            foreach (var dev in amdDevices)
            {
                ComputeDeviceManager.Available.HasAmd = true;

                var busID = dev.AMD_BUS_ID;
                if (busID != -1 && _busIdInfos.ContainsKey(busID))
                {
                    var deviceName = _busIdInfos[busID].Name;
                    var newAmdDev  = new AmdGpuDevice(dev, _driverOld[deviceName],
                                                      _busIdInfos[busID].InfSection, _noNeoscryptLyra2[deviceName])
                    {
                        DeviceName   = deviceName,
                        UUID         = _busIdInfos[busID].Uuid,
                        AdapterIndex = _busIdInfos[busID].Adl1Index
                    };
                    var isDisabledGroup = ConfigManager.GeneralConfig.DeviceDetection
                                          .DisableDetectionAMD;
                    var skipOrAdd          = isDisabledGroup ? "SKIPED" : "ADDED";
                    var isDisabledGroupStr = isDisabledGroup ? " (AMD group disabled)" : "";
                    var etherumCapableStr  = newAmdDev.IsEtherumCapable() ? "YES" : "NO";

                    ComputeDeviceManager.Available.Devices.Add(
                        new AmdComputeDevice(newAmdDev, ++ComputeDeviceManager.Query.GpuCount, false, _busIdInfos[busID].Adl2Index));
                    // just in case
                    try
                    {
                        stringBuilder.AppendLine($"\t{skipOrAdd} device{isDisabledGroupStr}:");
                        stringBuilder.AppendLine($"\t\tID: {newAmdDev.DeviceID}");
                        stringBuilder.AppendLine($"\t\tNAME: {newAmdDev.DeviceName}");
                        stringBuilder.AppendLine($"\t\tCODE_NAME: {newAmdDev.Codename}");
                        stringBuilder.AppendLine($"\t\tUUID: {newAmdDev.UUID}");
                        stringBuilder.AppendLine(
                            $"\t\tMEMORY: {newAmdDev.DeviceGlobalMemory}");
                        stringBuilder.AppendLine($"\t\tETHEREUM: {etherumCapableStr}");
                    }
                    catch { }
                }
                else
                {
                    stringBuilder.AppendLine($"\tDevice not added, Bus No. {busID} not found:");
                }
            }
            Helpers.ConsolePrint(Tag, stringBuilder.ToString());

            return(amdDevices);
        }
Exemplo n.º 3
0
        private AmdComputeDevice amdComputeDevDriverDisabled()
        {
            var openCLDev = new NiceHashMiner.Devices.Querying.Amd.OpenCL.OpenCLDevice();

            openCLDev.AMD_BUS_ID = 0;
            openCLDev.DeviceID   = 0;
            openCLDev._CL_DEVICE_GLOBAL_MEM_SIZE = 11589934592;
            openCLDev._CL_DEVICE_NAME            = "Vega 64";
            var amdDev     = new AmdGpuDevice(openCLDev, "", true, "Vega 64", "radeonGpuUUID");
            var amdCompDev = new AmdComputeDevice(amdDev, 0, false, 0);

            return(amdCompDev);
        }
Exemplo n.º 4
0
        private AmdComputeDevice amdComputeDevLowGCN()
        {
            var openCLDev = new NiceHashMiner.Devices.Querying.Amd.OpenCL.OpenCLDevice();

            openCLDev.AMD_BUS_ID = 0;
            openCLDev.DeviceID   = 0;
            openCLDev._CL_DEVICE_GLOBAL_MEM_SIZE = 11589934592;
            openCLDev._CL_DEVICE_NAME            = "Radeon R7 360";
            var amdDev     = new AmdGpuDevice(openCLDev, "", false, "R7 360", "radeonGpuUUID");
            var amdCompDev = new AmdComputeDevice(amdDev, 0, false, 0);

            return(amdCompDev);
        }
        protected override IEnumerable <AmdGpuDevice> CreateGpuDevices(List <OpenCLDevice> amdDevices,
                                                                       Dictionary <string, bool> disableAlgos)
        {
            Helpers.ConsolePrint(Tag, "Using AMD device creation DEFAULT Reliable mappings");
            foreach (var dev in amdDevices)
            {
                var busID = dev.AMD_BUS_ID;
                if (busID != -1 && _busIDInfos.ContainsKey(busID))
                {
                    var deviceName = _busIDInfos[busID].Name;
                    disableAlgos.TryGetValue(deviceName, out var disableAlgo);
                    var newAmdDev = new AmdGpuDevice(dev,
                                                     disableAlgo,
                                                     deviceName,
                                                     _busIDInfos[busID]);

                    yield return(newAmdDev);
                }
                else
                {
                    Helpers.ConsolePrint(Tag, $"\tDevice not added, Bus No. {busID} not found:");
                }
            }
        }
Exemplo n.º 6
0
        private List <OpenCLDevice> AmdDeviceCreationFallback(List <OpenCLDevice> amdDevices)
        {
            Helpers.ConsolePrint(Tag, "Using AMD device creation FALLBACK UnReliable mappings");
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("");
            stringBuilder.AppendLine("QueryAMD [FALLBACK query] devices: ");

            // get video AMD controllers and sort them by RAM
            // (find a way to get PCI BUS Numbers from PNPDeviceID)
            var amdVideoControllers = _availableControllers.Where(vcd =>
                                                                  vcd.Name.ToLower().Contains("amd") || vcd.Name.ToLower().Contains("radeon") ||
                                                                  vcd.Name.ToLower().Contains("firepro")).ToList();

            // sort by ram not ideal
            amdVideoControllers.Sort((a, b) => (int)(a.AdapterRam - b.AdapterRam));
            amdDevices.Sort((a, b) =>
                            (int)(a._CL_DEVICE_GLOBAL_MEM_SIZE - b._CL_DEVICE_GLOBAL_MEM_SIZE));
            var minCount = Math.Min(amdVideoControllers.Count, amdDevices.Count);

            for (var i = 0; i < minCount; ++i)
            {
                ComputeDeviceManager.Available.HasAmd = true;

                var deviceName = amdVideoControllers[i].Name;
                if (amdVideoControllers[i].InfSection == null)
                {
                    amdVideoControllers[i].InfSection = "";
                }
                var newAmdDev = new AmdGpuDevice(amdDevices[i], _driverOld[deviceName],
                                                 amdVideoControllers[i].InfSection,
                                                 _noNeoscryptLyra2[deviceName])
                {
                    DeviceName = deviceName,
                    UUID       = "UNUSED"
                };
                var isDisabledGroup = ConfigManager.GeneralConfig.DeviceDetection
                                      .DisableDetectionAMD;
                var skipOrAdd          = isDisabledGroup ? "SKIPED" : "ADDED";
                var isDisabledGroupStr = isDisabledGroup ? " (AMD group disabled)" : "";
                var etherumCapableStr  = newAmdDev.IsEtherumCapable() ? "YES" : "NO";

                ComputeDeviceManager.Available.Devices.Add(
                    new AmdComputeDevice(newAmdDev, ++ComputeDeviceManager.Query.GpuCount, true, -1));
                // just in case
                try
                {
                    stringBuilder.AppendLine($"\t{skipOrAdd} device{isDisabledGroupStr}:");
                    stringBuilder.AppendLine($"\t\tID: {newAmdDev.DeviceID}");
                    stringBuilder.AppendLine($"\t\tNAME: {newAmdDev.DeviceName}");
                    stringBuilder.AppendLine($"\t\tCODE_NAME: {newAmdDev.Codename}");
                    stringBuilder.AppendLine($"\t\tUUID: {newAmdDev.UUID}");
                    stringBuilder.AppendLine(
                        $"\t\tMEMORY: {newAmdDev.DeviceGlobalMemory}");
                    stringBuilder.AppendLine($"\t\tETHEREUM: {etherumCapableStr}");
                }
                catch
                {
                }
            }

            Helpers.ConsolePrint(Tag, stringBuilder.ToString());

            return(amdDevices);
        }