From b205a5665a5cf19e85d56e9930feb892e73b9a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Lie=CC=81tar?= Date: Wed, 15 Apr 2020 17:05:45 +0200 Subject: [PATCH 1/5] Don't require 16-byte CAS on x86. We only need to CAS 2 pointers, which is always possible on x86. --- azure-pipelines.yml | 48 ++++++++++++++++++++++++++++++++++----------- ci/linux_x86 | 7 +++++++ src/ds/aba.h | 3 ++- 3 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 ci/linux_x86 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f65fe87b1..493ad7a2b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,80 +9,106 @@ jobs: displayName: Linux pool: vmImage: 'ubuntu-18.04' - container: snmallocciteam/build_linux_x64:latest strategy: matrix: - Clang-7 Debug: + 64-bit Clang-7 Debug: CC: clang-7 CXX: clang++-7 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-7 Release: + 64-bit Clang-7 Release: CC: clang-7 CXX: clang++-7 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-8 Debug: + 64-bit Clang-8 Debug: CC: clang-8 CXX: clang++-8 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-8 Release: + 64-bit Clang-8 Release: CC: clang-8 CXX: clang++-8 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-9 Debug: + 64-bit Clang-9 Debug: CC: clang-9 CXX: clang++-9 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-9 Release: + 64-bit Clang-9 Release: CC: clang-9 CXX: clang++-9 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - GCC-8 Debug: + 64-bit GCC-8 Debug: CC: gcc-8 CXX: g++-8 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - GCC-8 Release: + 64-bit GCC-8 Release: CC: gcc-8 CXX: g++-8 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Self Host: + 64-bit Self Host: CC: clang-7 CXX: clang++-7 BuildType: Debug SelfHost: true CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Cache Friendly: + 64-bit Cache Friendly: CC: clang-7 CXX: clang++-7 BuildType: Debug SelfHost: false CMakeArgs: '-DCACHE_FRIENDLY_OFFSET=64' + Image: snmallocciteam/build_linux_x64:latest + + 32-bit Clang-9 Debug: + CC: clang-9 + CXX: clang++-9 + BuildType: Debug + SelfHost: false + CMakeArgs: '' + Image: plietar/snmalloc-build_linux_x86:latest + + 32-bit Clang-9 Release: + CC: clang-9 + CXX: clang++-9 + BuildType: Release + SelfHost: false + CMakeArgs: '' + Image: plietar/snmalloc-build_linux_x86:latest + container: $(Image) steps: - script: | ci/scripts/build.sh diff --git a/ci/linux_x86 b/ci/linux_x86 new file mode 100644 index 000000000..6124ddf43 --- /dev/null +++ b/ci/linux_x86 @@ -0,0 +1,7 @@ +FROM multiarch/ubuntu-core:x86-bionic + +WORKDIR /src + +RUN apt update \ + && apt install --no-install-recommends -y ninja-build clang++-9 cmake \ + && apt -y clean diff --git a/src/ds/aba.h b/src/ds/aba.h index 38aaa3605..b7bb56fc9 100644 --- a/src/ds/aba.h +++ b/src/ds/aba.h @@ -99,9 +99,10 @@ namespace snmalloc (__int64)value, (__int64*)&old); # else -# if defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) +# if defined(__GNUC__) && defined(SNMALLOC_VA_BITS_64) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) #error You must compile with -mcx16 to enable 16-byte atomic compare and swap. # endif + Linked xchg{value, old.aba + 1}; std::atomic& addr = parent->linked; From 3a04cdcfc749be6391d8e8f95377dd5a5a30e12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Lie=CC=81tar?= Date: Wed, 15 Apr 2020 17:37:02 +0200 Subject: [PATCH 2/5] Fix the way the Image variable is referenced. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 493ad7a2b..0e6ee473f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,7 +108,7 @@ jobs: CMakeArgs: '' Image: plietar/snmalloc-build_linux_x86:latest - container: $(Image) + container: $[ variables['Image'] ] steps: - script: | ci/scripts/build.sh From 644f5d917aa99c879158eb9d070d554c408abe3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Lie=CC=81tar?= Date: Wed, 15 Apr 2020 17:40:29 +0200 Subject: [PATCH 3/5] Replace failOnStderr by `set -eo pipefail` on Linux. The x86 image doesn't have clangformat, which causes cmake to print a warning on the stderr. Exit codes should be enough to detect failure. --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0e6ee473f..a0d0b557a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -111,21 +111,21 @@ jobs: container: $[ variables['Image'] ] steps: - script: | + set -eo pipefail ci/scripts/build.sh env: CC: $(CC) CXX: $(CXX) BUILD_TYPE: $(BuildType) CMAKE_ARGS: $(CMakeArgs) - failOnStderr: true displayName: 'Build' - script: | + set -eo pipefail ci/scripts/test.sh env: SELF_HOST: $(SelfHost) BUILD_TYPE: $(BuildType) - failOnStderr: true displayName: 'Test' - job: From 3f304b284156dda1aa6d048658e9cc9f75f03d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Lie=CC=81tar?= Date: Wed, 15 Apr 2020 17:49:27 +0200 Subject: [PATCH 4/5] Use x86 images from snmallocciteam. --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a0d0b557a..30253d794 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -98,7 +98,7 @@ jobs: BuildType: Debug SelfHost: false CMakeArgs: '' - Image: plietar/snmalloc-build_linux_x86:latest + Image: snmallocciteam/build_linux_x86:latest 32-bit Clang-9 Release: CC: clang-9 @@ -106,7 +106,7 @@ jobs: BuildType: Release SelfHost: false CMakeArgs: '' - Image: plietar/snmalloc-build_linux_x86:latest + Image: snmallocciteam/build_linux_x86:latest container: $[ variables['Image'] ] steps: From 9412233bbd1d258f1b5ed763f929712cdf80cb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Lie=CC=81tar?= Date: Wed, 15 Apr 2020 18:12:17 +0200 Subject: [PATCH 5/5] clang-format --- src/ds/aba.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ds/aba.h b/src/ds/aba.h index b7bb56fc9..21950ff33 100644 --- a/src/ds/aba.h +++ b/src/ds/aba.h @@ -99,7 +99,8 @@ namespace snmalloc (__int64)value, (__int64*)&old); # else -# if defined(__GNUC__) && defined(SNMALLOC_VA_BITS_64) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) +# if defined(__GNUC__) && defined(SNMALLOC_VA_BITS_64) && \ + !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) #error You must compile with -mcx16 to enable 16-byte atomic compare and swap. # endif