Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 0eb449a

Browse files
authored
Reverting the PR #881 to investigate the QDK Release failures. (#888)
1 parent 2080f80 commit 0eb449a

File tree

16 files changed

+68
-167
lines changed

16 files changed

+68
-167
lines changed

build/ci-codecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
linux:
2828
imageName: 'ubuntu-latest'
2929
mac:
30-
imageName: 'macOS-latest'
30+
imageName: 'macOS-10.15'
3131
#windows: # No sanitizers supported on Win at the moment.
3232
# imageName: 'windows-latest'
3333
pool:

build/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
linux:
3232
imageName: 'ubuntu-latest'
3333
mac:
34-
imageName: 'macOS-latest'
34+
imageName: 'macOS-10.15'
3535
windows:
3636
imageName: 'windows-latest'
3737
pool:

build/steps-codecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ steps:
1010

1111
# QIR Runtime:
1212
- pwsh: src/Qir/Runtime/prerequisites.ps1
13-
displayName: "Install QIR Runtime Prerequisites"
13+
displayName: "Install QIR Runtime Prerequisistes"
1414
workingDirectory: $(System.DefaultWorkingDirectory)
1515

1616
- pwsh: src/Qir/Runtime/build-qir-runtime.ps1

src/Qir/Common/cmake/unit_test_include.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ macro(add_unit_test target)
99
if(DEFINED ENV{NATIVE_SIMULATOR})
1010
set(TEST_DEPS1 $ENV{NATIVE_SIMULATOR})
1111
else()
12-
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/drop")
12+
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/$ENV{BUILD_CONFIGURATION}")
1313
endif()
1414

1515
set(TEST_DEPS2 "${CMAKE_BINARY_DIR}/bin")

src/Qir/Runtime/lib/Simulators/FullstateSimulator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace Quantum
211211
{
212212
if (this->simulatorId != NULL_SIMULATORID)
213213
{
214-
typedef void (*TDestroy)(unsigned);
214+
typedef unsigned (*TDestroy)(unsigned);
215215
static TDestroy destroySimulatorInstance =
216216
reinterpret_cast<TDestroy>(LoadProc(this->handle, "destroy"));
217217
assert(destroySimulatorInstance);
@@ -226,7 +226,7 @@ namespace Quantum
226226
// Deprecated, use `DumpMachine()` and `DumpRegister()` instead.
227227
void GetState(TGetStateCallback callback) override
228228
{
229-
typedef void (*TDump)(unsigned, TGetStateCallback);
229+
typedef bool (*TDump)(unsigned, TGetStateCallback);
230230
static TDump dump = reinterpret_cast<TDump>(this->GetProc("Dump"));
231231
dump(this->simulatorId, callback);
232232
}
@@ -462,7 +462,7 @@ namespace Quantum
462462

463463
void R(PauliId axis, QubitIdType target, double theta) override
464464
{
465-
typedef void (*TR)(unsigned, unsigned, double, unsigned);
465+
typedef unsigned (*TR)(unsigned, unsigned, double, unsigned);
466466
static TR r = reinterpret_cast<TR>(this->GetProc("R"));
467467

468468
r(this->simulatorId, GetBasis(axis), theta, GetQubitId(target));
@@ -472,7 +472,7 @@ namespace Quantum
472472
void ControlledR(long numControls, QubitIdType controls[], PauliId axis, QubitIdType target,
473473
double theta) override
474474
{
475-
typedef void (*TMCR)(unsigned, unsigned, double, unsigned, unsigned*, unsigned);
475+
typedef unsigned (*TMCR)(unsigned, unsigned, double, unsigned, unsigned*, unsigned);
476476
static TMCR cr = reinterpret_cast<TMCR>(this->GetProc("MCR"));
477477

478478
std::vector<unsigned> ids = GetQubitIds(numControls, controls);
@@ -483,7 +483,7 @@ namespace Quantum
483483

484484
void Exp(long numTargets, PauliId paulis[], QubitIdType targets[], double theta) override
485485
{
486-
typedef void (*TExp)(unsigned, unsigned, unsigned*, double, unsigned*);
486+
typedef unsigned (*TExp)(unsigned, unsigned, unsigned*, double, unsigned*);
487487
static TExp exp = reinterpret_cast<TExp>(this->GetProc("Exp"));
488488
std::vector<unsigned> ids = GetQubitIds(numTargets, targets);
489489
std::vector<unsigned> convertedBases = GetBases(numTargets, paulis);
@@ -494,7 +494,7 @@ namespace Quantum
494494
void ControlledExp(long numControls, QubitIdType controls[], long numTargets, PauliId paulis[],
495495
QubitIdType targets[], double theta) override
496496
{
497-
typedef void (*TMCExp)(unsigned, unsigned, unsigned*, double, unsigned, unsigned*, unsigned*);
497+
typedef unsigned (*TMCExp)(unsigned, unsigned, unsigned*, double, unsigned, unsigned*, unsigned*);
498498
static TMCExp cexp = reinterpret_cast<TMCExp>(this->GetProc("MCExp"));
499499
std::vector<unsigned> idsTargets = GetQubitIds(numTargets, targets);
500500
std::vector<unsigned> idsControls = GetQubitIds(numControls, controls);

src/Qir/Runtime/public/QubitManager.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ namespace Quantum
4040
// No complex scenarios for now. Don't need to support copying/moving.
4141
CQubitManager(const CQubitManager&) = delete;
4242
CQubitManager& operator=(const CQubitManager&) = delete;
43-
~CQubitManager(); // If this dtor is made _virtual_ then the QIR RT tests crash (at least in Debug config)
44-
// if the native simulator is compiled with Clang (as opposed to GCC). Nothing wrong found in
45-
// the code, probably is the compiler bug.
43+
virtual ~CQubitManager();
4644

4745
// Restricted reuse area control
4846
void StartRestrictedReuseArea();

src/Qir/Runtime/test-qir-runtime.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
. (Join-Path $PSScriptRoot .. qir-utils.ps1)
55

6+
# TODO: `ASAN_OPTIONS=check_initialization_order=1` (https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking).
67
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
7-
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:" `
8-
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
9-
+ "detect_invalid_pointer_pairs=2"
108

119
if (-not (Test-CTest (Join-Path $PSScriptRoot bin $Env:BUILD_CONFIGURATION unittests) "QIR Runtime")) {
1210
throw "At least one project failed testing. Check the logs."

src/Qir/Samples/StandaloneInputReference/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_test(
3434
if(DEFINED ENV{NATIVE_SIMULATOR})
3535
set(TEST_DEPS1 $ENV{NATIVE_SIMULATOR})
3636
else()
37-
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/drop")
37+
set(TEST_DEPS1 "${PROJECT_SOURCE_DIR}/../../Simulation/native/build/$ENV{BUILD_CONFIGURATION}")
3838
endif()
3939

4040
set(TEST_DEPS2 "${PROJECT_SOURCE_DIR}/../Runtime/bin/$ENV{BUILD_CONFIGURATION}/bin")

src/Qir/Samples/test-qir-samples.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
. (Join-Path $PSScriptRoot .. qir-utils.ps1)
55

6+
# TODO: `ASAN_OPTIONS=check_initialization_order=1` (https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking).
67
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
7-
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:" `
8-
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
9-
+ "detect_invalid_pointer_pairs=2"
108

119
if (-not (Test-CTest (Join-Path $PSScriptRoot bin $Env:BUILD_CONFIGURATION StandaloneInputReference) "QIR Samples (StandaloneInputReference)")) {
1210
throw "At least one project failed testing. Check the logs."

src/Qir/Tests/test-qir-tests.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ if ($Env:BUILD_CONFIGURATION -eq "Debug")
1616
if (-not ($IsWindows))
1717
{
1818
$env:LSAN_OPTIONS += "suppressions=../../../../LSan.ignore" # https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-memory-leaks
19-
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
20-
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:" `
21-
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true"
22-
# + ":detect_invalid_pointer_pairs=2" TODO(rokuzmin, #883): ==8218==ERROR: AddressSanitizer: invalid-pointer-pair: 0x602000000af4 0x602000000af0
19+
if (-not ($IsMacOS))
20+
{
21+
$env:ASAN_OPTIONS += "check_initialization_order=1" # https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking
22+
}
23+
#else # AddressSanitizer: detect_leaks is not supported on this platform. Re-enable this once supported.
24+
#{
25+
# $env:ASAN_OPTIONS += "detect_leaks=1" # https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection
26+
#}
2327
}
2428
}
2529

0 commit comments

Comments
 (0)