Fix AMD by changing from GetTensorData<T>() to GetTensorMutableData<T>()

This commit is contained in:
2026-04-28 13:25:02 +10:00
parent f4b74c837e
commit dcf974c35c
18 changed files with 359 additions and 48 deletions

View File

@@ -80,6 +80,17 @@ namespace {
return s.substr(0, 4) + std::string(s.size() - 8, '*') + s.substr(s.size() - 4);
}
// SDK identifier passed to ANSLSHelper for licensing-service auth. Despite
// the variable name "privateKey" used at call sites, this is an 11-byte
// SDK token that identifies the ANSCENTER product to the licensing
// service — NOT a cryptographic signing key. Centralised here so any
// future rotation (or move to runtime lookup via env var / config file)
// touches one place instead of duplicated literals scattered across the
// file. Narrow form is the source of truth; wide form is derived to
// avoid two literals drifting out of sync.
inline std::string GetSdkKey() { return "AQlSAiRTNtS7X20="; }
inline std::wstring GetSdkKeyW() { return String2WString(GetSdkKey()); }
// Append both `\` and `/` slash flavours of `raw` to `dst`, lower-cased
// and with a trailing separator forced. Empty / pathologically short
// entries are skipped.
@@ -661,7 +672,7 @@ namespace ANSCENTER
try {
int _enableFeature;
int _productId;
std::string privateKey = "AQlSAiRTNtS7X20=";
std::string privateKey = GetSdkKey();
int activationResult = 0;
std::string licensingServiceURL = "https://licensingservice.anscenter.com/";
ANSCENTER::ANSLSHelper ansHelper(privateKey, licensingServiceURL);
@@ -775,7 +786,7 @@ namespace ANSCENTER
try {
int productId;
std::string registrationName;
std::string privateKey = "AQlSAiRTNtS7X20=";
std::string privateKey = GetSdkKey();
std::string licensingServiceURL = "https://licensingservice.anscenter.com/";
ANSCENTER::ANSLSHelper ansHelper(privateKey, licensingServiceURL);
ansHelper.SetupLicenseTemplate();
@@ -836,7 +847,7 @@ namespace ANSCENTER
int ANSLicenseHelper::DeactivateLicense(std::string productName) {
std::string licenseDirectory = GetLicenseDir();
std::vector<std::string> licenseKeyFiles = ListFilesInFolder(licenseDirectory);
std::string privateKey = "AQlSAiRTNtS7X20=";
std::string privateKey = GetSdkKey();
std::string licensingServiceURL = "https://licensingservice.anscenter.com/";
ANSCENTER::ANSLSHelper ansHelper(privateKey, licensingServiceURL);
ansHelper.SetupLicenseTemplate();
@@ -901,7 +912,7 @@ namespace ANSCENTER
return 0;
}
int ANSLicenseHelper::ActivateLicense(std::string productName, std::string licenseKey) {
std::string privateKey = "AQlSAiRTNtS7X20=";
std::string privateKey = GetSdkKey();
std::string licensingServiceURL = "https://licensingservice.anscenter.com/";
ANSCENTER::ANSLSHelper ansHelper(privateKey, licensingServiceURL);
ansHelper.SetupLicenseTemplate();
@@ -942,7 +953,7 @@ namespace ANSCENTER
}
int ANSLicenseHelper::ActivateLicenseWithCustomHWID(std::string productName, std::string licenseKey, std::string hwid, std::string &activationKey) {
std::string privateKey = "AQlSAiRTNtS7X20=";
std::string privateKey = GetSdkKey();
std::string licensingServiceURL = "https://licensingservice.anscenter.com/";
ANSCENTER::ANSLSHelper ansHelper(privateKey, licensingServiceURL);
ansHelper.SetupLicenseTemplate();
@@ -1020,7 +1031,7 @@ namespace ANSCENTER
std::string licenseDirectory = GetLicenseDir();
std::vector<std::string> licenseKeyFiles = ListFilesInFolder(licenseDirectory);
std::string privateKey = "AQlSAiRTNtS7X20=";
std::string privateKey = GetSdkKey();
std::string licensingServiceURL = "https://licensingservice.anscenter.com/";
ANSCENTER::ANSLSHelper ansHelper(privateKey, licensingServiceURL);
ansHelper.SetupLicenseTemplate();
@@ -1224,7 +1235,7 @@ namespace ANSCENTER
ANSLSHelper::ANSLSHelper()
{
try {
this->_privateKey = _T("AQlSAiRTNtS7X20=");
this->_privateKey = GetSdkKeyW();
this->_licenseServiceURL = _T("https://licensingservice.anscenter.com/");
this->_sdkLicenseKey = _T("MYNSU-GBQ2Q-SF5U5-S3RVF-5ZKFD");
SDKRegistration::SetLicenseKey(_sdkLicenseKey.c_str());
@@ -1239,7 +1250,7 @@ namespace ANSCENTER
ANSLSHelper::ANSLSHelper(std::string licenseServiceURL)
{
try {
this->_privateKey = _T("AQlSAiRTNtS7X20=");
this->_privateKey = GetSdkKeyW();
this->_licenseServiceURL = String2WString(licenseServiceURL);
this->_sdkLicenseKey = _T("MYNSU-GBQ2Q-SF5U5-S3RVF-5ZKFD");
SDKRegistration::SetLicenseKey(_sdkLicenseKey.c_str());
@@ -1255,7 +1266,7 @@ namespace ANSCENTER
{
try {
if (privateKey.empty()) {
this->_privateKey = _T("AQlSAiRTNtS7X20=");
this->_privateKey = GetSdkKeyW();
}
else {
this->_privateKey = String2WString(privateKey);
@@ -1278,7 +1289,7 @@ namespace ANSCENTER
{
try {
if (privateKey.empty()) {
this->_privateKey = _T("AQlSAiRTNtS7X20=");
this->_privateKey = GetSdkKeyW();
}
else {
this->_privateKey = String2WString(privateKey);
@@ -1517,7 +1528,7 @@ namespace ANSCENTER
this->_licenseTemplate->SetDataSize(36); //16 bits for ProductId, 4 bits for FeatureBitMask, and 16 bits for ExpirationData (16+4+16 =36)
this->_licenseTemplate->SetTemplateId(_T("24880"));
if(this->_privateKey.empty())
this->_licenseTemplate->SetPrivateKey(_T("AQlSAiRTNtS7X20="));
this->_licenseTemplate->SetPrivateKey(GetSdkKeyW().c_str());
else this->_licenseTemplate->SetPrivateKey(this->_privateKey.c_str());
if (this->_publicKey.empty())