Fix mixed UTF16 issue (LabVIEW) and fix ANSFR for Intel

This commit is contained in:
2026-04-08 08:47:10 +10:00
parent 866e0282e2
commit a4a8caaa86
10 changed files with 594 additions and 38 deletions

View File

@@ -315,26 +315,30 @@ namespace ANSCENTER
EngineType ANSCENTER::ANSLicenseHelper::CheckHardwareInformation()
{
ANS_DBG("HWInfo", "CheckHardwareInformation: starting hardware detection");
bool cpuIntelAvailable = false;
bool gpuNvidiaAvailable = false;
bool gpuAMDAvailable = false;
bool gpuOpenVINOAvailable = false;
// ----------------------------------------------------------------
// CPU <EFBFBD> Intel socket detection (OpenVINO fallback)
// CPU Intel socket detection (OpenVINO fallback)
// ----------------------------------------------------------------
auto sockets = hwinfo::getAllSockets();
for (auto& socket : sockets) {
const auto& cpu = socket.CPU();
ANS_DBG("HWInfo", "CPU vendor=%s model=%s", cpu.vendor().c_str(), cpu.modelName().c_str());
if (cpu.vendor() == "GenuineIntel")
cpuIntelAvailable = true;
}
// ----------------------------------------------------------------
// GPU <EFBFBD> classify all adapters by vendor string
// GPU classify all adapters by vendor string
// ----------------------------------------------------------------
auto gpus = hwinfo::getAllGPUs();
ANS_DBG("HWInfo", "Found %zu GPU adapter(s)", gpus.size());
for (auto& gpu : gpus) {
std::string vendor = gpu.vendor();
ANS_DBG("HWInfo", "GPU: name=%s vendor=%s", gpu.name().c_str(), vendor.c_str());
std::cout << "[HWInfo] Detected GPU: " << gpu.name() << " (Vendor: " << vendor << ")" << std::endl;
// Normalize to uppercase for reliable substring matching
std::transform(vendor.begin(), vendor.end(),
@@ -345,12 +349,18 @@ namespace ANSCENTER
if (vendor.find("INTEL") != std::string::npos)
gpuOpenVINOAvailable = true;
// AMD cards report as "AMD", "Advanced Micro Devices", or
// legacy "ATI" branding
// legacy "ATI Technologies" branding.
// NOTE: "ATI" alone is too broad — "INTEL CORPORATION" contains
// "ATI" inside "CORPOR-ATI-ON", causing a false positive.
// Use "ATI " (with trailing space) to match "ATI Technologies"
// or "ATI Radeon" without matching "CORPORATION".
if (vendor.find("AMD") != std::string::npos ||
vendor.find("ADVANCED") != std::string::npos ||
vendor.find("ATI") != std::string::npos)
vendor.find("ADVANCED MICRO") != std::string::npos ||
vendor.find("ATI ") != std::string::npos)
gpuAMDAvailable = true;
}
ANS_DBG("HWInfo", "Detection: cpuIntel=%d gpuNvidia=%d gpuAMD=%d gpuOpenVINO=%d",
cpuIntelAvailable, gpuNvidiaAvailable, gpuAMDAvailable, gpuOpenVINOAvailable);
// ----------------------------------------------------------------
// Priority: NVIDIA > AMD > Intel OpenVINO > CPU
@@ -361,19 +371,23 @@ namespace ANSCENTER
// ----------------------------------------------------------------
if (gpuNvidiaAvailable) {
std::cout << "[HWInfo] Engine: NVIDIA GPU -> CUDA" << std::endl;
ANS_DBG("HWInfo", "Selected: NVIDIA_GPU (CUDA)");
return EngineType::NVIDIA_GPU;
//return EngineType::OPENVINO_GPU;
}
if (gpuAMDAvailable) {
std::cout << "[HWInfo] Engine: AMD GPU -> DirectML" << std::endl;
ANS_DBG("HWInfo", "Selected: AMD_GPU (DirectML)");
return EngineType::AMD_GPU;
}
if (gpuOpenVINOAvailable) {
std::cout << "[HWInfo] Engine: Intel CPU -> OpenVINO" << std::endl;
ANS_DBG("HWInfo", "Selected: OPENVINO_GPU (OpenVINO)");
return EngineType::OPENVINO_GPU;
}
std::cout << "[HWInfo] Engine: CPU (fallback)" << std::endl;
ANS_DBG("HWInfo", "Selected: CPU (fallback)");
return EngineType::CPU;
}

View File

@@ -8,7 +8,7 @@
// Set to 0 for production builds to eliminate all debug output overhead.
// ============================================================================
#ifndef ANSCORE_DEBUGVIEW
#define ANSCORE_DEBUGVIEW 0 // 1 = enabled (debug), 0 = disabled (production)
#define ANSCORE_DEBUGVIEW 1 // 1 = enabled (debug), 0 = disabled (production)
#endif
// ANS_DBG: Debug logging macro for DebugView (OutputDebugStringA on Windows).