From f45d98ba5071d3e9d8888d8f591cddddfef2dda7 Mon Sep 17 00:00:00 2001 From: TB Schardl Date: Sun, 25 Jan 2026 21:11:21 -0500 Subject: [PATCH 1/2] Update Cilkscale and Cilksan regression tests to use updated Cilk headers. --- cilkscale/benchmark.cpp | 3 +-- cilkscale/cilkscale.cpp | 3 +-- test/cilksan/TestCases/ploop-spawn.cpp | 4 +--- test/cilksan/TestCases/reducer-lock-test.cpp | 7 +++---- test/cilksan/TestCases/sum-ints.cpp | 4 +--- test/cilksan/TestCases/sum-vector-int.cpp | 20 +++++++++----------- 6 files changed, 16 insertions(+), 25 deletions(-) diff --git a/cilkscale/benchmark.cpp b/cilkscale/benchmark.cpp index 1d1a8af..af03bea 100644 --- a/cilkscale/benchmark.cpp +++ b/cilkscale/benchmark.cpp @@ -27,8 +27,7 @@ #if SERIAL_TOOL #include #else // !SERIAL_TOOL -#include -#include +#include using out_reducer = cilk::ostream_reducer; #endif // SERIAL_TOOL diff --git a/cilkscale/cilkscale.cpp b/cilkscale/cilkscale.cpp index 7178b90..be23d92 100644 --- a/cilkscale/cilkscale.cpp +++ b/cilkscale/cilkscale.cpp @@ -28,8 +28,7 @@ #if SERIAL_TOOL FILE *err_io = stderr; #else // !SERIAL_TOOL -#include -#include +#include using out_reducer = cilk::ostream_reducer; #endif // SERIAL_TOOL diff --git a/test/cilksan/TestCases/ploop-spawn.cpp b/test/cilksan/TestCases/ploop-spawn.cpp index 288716d..55b48ab 100644 --- a/test/cilksan/TestCases/ploop-spawn.cpp +++ b/test/cilksan/TestCases/ploop-spawn.cpp @@ -1,12 +1,10 @@ // RUN: %clangxx_cilksan -fopencilk -Og %s -o %t // RUN: %run %t 2>&1 | FileCheck %s +#include #include #include #include -#include -#include - template void sum(std::vector &v) { T sum_racy = 0; cilk::opadd_reducer sum_pos = 0; diff --git a/test/cilksan/TestCases/reducer-lock-test.cpp b/test/cilksan/TestCases/reducer-lock-test.cpp index dae9e94..1024909 100644 --- a/test/cilksan/TestCases/reducer-lock-test.cpp +++ b/test/cilksan/TestCases/reducer-lock-test.cpp @@ -1,12 +1,11 @@ // RUN: %clangxx_cilksan -fopencilk -Og %s -o %t // RUN: %run %t 2>&1 | FileCheck %s -#include -#include -#include #include -#include +#include #include +#include +#include int main() { cilk::opadd_reducer sum = 0; diff --git a/test/cilksan/TestCases/sum-ints.cpp b/test/cilksan/TestCases/sum-ints.cpp index 902017d..ae286f6 100644 --- a/test/cilksan/TestCases/sum-ints.cpp +++ b/test/cilksan/TestCases/sum-ints.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -27,8 +26,7 @@ #include #include #include - -#include +#include #include #include diff --git a/test/cilksan/TestCases/sum-vector-int.cpp b/test/cilksan/TestCases/sum-vector-int.cpp index 8f2a6a7..a024336 100644 --- a/test/cilksan/TestCases/sum-vector-int.cpp +++ b/test/cilksan/TestCases/sum-vector-int.cpp @@ -32,21 +32,19 @@ */ -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include #include -#include -#include +#include +#include #include +#include +#include +#include #include - -#include +#include #ifdef WLS #include From 3149f9bf6e8a3fff908a399583d4bfad792ccfad Mon Sep 17 00:00:00 2001 From: TB Schardl Date: Sun, 25 Jan 2026 21:47:53 -0500 Subject: [PATCH 2/2] Fix some build warnings and clean up code. --- cilksan/csanrt.cpp | 2 +- cilksan/dictionary.h | 6 +++--- cilksan/disjointset.h | 4 ++-- cilksan/driver.cpp | 2 +- cilksan/locking.cpp | 4 ++-- cilksan/simple_shadow_mem.h | 8 ++++---- cilksan/spbag.h | 4 ++-- cilkscale/benchmark.cpp | 2 +- cilkscale/cilkscale.cpp | 2 +- cmake/config-ix.cmake | 18 +++++++++--------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cilksan/csanrt.cpp b/cilksan/csanrt.cpp index 19b9d58..c3c04b2 100644 --- a/cilksan/csanrt.cpp +++ b/cilksan/csanrt.cpp @@ -505,7 +505,7 @@ void __csanrt_unit_init( acquired = 1; assert(lock == acquired); - int res = lock.compare_exchange_strong( + [[maybe_unused]] int res = lock.compare_exchange_strong( acquired, 0, std::memory_order::memory_order_seq_cst); assert(res); } diff --git a/cilksan/dictionary.h b/cilksan/dictionary.h index 47c67d9..05f6b55 100644 --- a/cilksan/dictionary.h +++ b/cilksan/dictionary.h @@ -48,7 +48,7 @@ class MemoryAccess_t { csi_id_t ver_acc_id = UNKNOWN_CSI_ACC_ID; // Default constructor - MemoryAccess_t() {} + MemoryAccess_t() = default; MemoryAccess_t(DS_t *func, version_t version, csi_id_t acc_id, MAType_t type) : ver_func(makeVerFunc(func, version)), ver_acc_id(makeTypedID(acc_id, type)) { @@ -120,7 +120,7 @@ class MemoryAccess_t { // Set the fields of this MemoryAccess_t directly. This method is used to // avoid unnecessary updates to reference counts that may be incurred by using - // the copy contructor. + // the copy constructor. void set(DS_t *func, version_t version, csi_id_t acc_id, MAType_t type) { DS_t *this_func = getFuncFromVerFunc(); if (this_func != func) { @@ -233,7 +233,7 @@ class MemoryAccess_t { // } // } - // Logic to check if the given previous MemoryAccess_t is logically in + // Check if the given previous MemoryAccess_t is logically in // parallel with the current strand. __attribute__((always_inline)) static bool previousAccessInParallel(MemoryAccess_t *PrevAccess, const FrameData_t *f) { diff --git a/cilksan/disjointset.h b/cilksan/disjointset.h index e50583a..14de2ae 100644 --- a/cilksan/disjointset.h +++ b/cilksan/disjointset.h @@ -119,7 +119,7 @@ class DisjointSet_t { return _list; } - // The length of the list. Automically reset to 0 on unlock(). + // The length of the list. Automatically reset to 0 on unlock(). __attribute__((always_inline)) int length() { return _length; } // Crashes the program if lock() is called a second time before unlock(). @@ -571,7 +571,7 @@ class DisjointSet_t { FullSlabs = Slab; } - cilksan_assert(DJSet && "No disjoinst set found."); + cilksan_assert(DJSet && "No disjoint set found."); return DJSet; } diff --git a/cilksan/driver.cpp b/cilksan/driver.cpp index e748965..79d5cde 100644 --- a/cilksan/driver.cpp +++ b/cilksan/driver.cpp @@ -1128,7 +1128,7 @@ static std::map pages_to_clear; // dlsym uses some of the memory functions we are trying to interpose, which // means that calling dlsym directly will lead to infinite recursion and a // segfault. Fortunately, dlsym can make do with memory-allocation functions -// returning NULL, so we return NULL when we detect this inifinite recursion. +// returning NULL, so we return NULL when we detect this infinite recursion. // // This trick seems questionable, but it also seems to be standard practice. // It's the same trick used by memusage.c in glibc, and there's little diff --git a/cilksan/locking.cpp b/cilksan/locking.cpp index c528aac..2b82c48 100644 --- a/cilksan/locking.cpp +++ b/cilksan/locking.cpp @@ -15,9 +15,9 @@ static LockID_t next_lock_id = atomic_lock_id + 1; // Map from memory addresses to locks allocated at those locations. static AddrMap_t lock_ids; -static inline void emit_acquire_release_warning(bool is_aquire, +static inline void emit_acquire_release_warning(bool is_acquire, const void *mutex) { - if (is_aquire) + if (is_acquire) fprintf(err_io, "Cilksan Warning: Cannot model lock-acquire of unknown lock at " "location %p\n", diff --git a/cilksan/simple_shadow_mem.h b/cilksan/simple_shadow_mem.h index fc07de2..5c66dc1 100644 --- a/cilksan/simple_shadow_mem.h +++ b/cilksan/simple_shadow_mem.h @@ -55,7 +55,7 @@ template class SimpleDictionary { static constexpr uintptr_t LINE_IDX_MASK = LINE_MASK ^ PAGE_MASK; // Helper methods to get the indices into the dictionary from a given address. - // We used these helper methods, rather than a bitfiled struct, because the + // We used these helper methods, rather than a bitfield struct, because the // language standard provides too few guarantees on the order of fields in a // bitfield struct. __attribute__((always_inline)) static uintptr_t byte(uintptr_t addr) { @@ -156,7 +156,7 @@ template class SimpleDictionary { Chunk_t() = delete; }; - // Helper methods to check if chunk startsat a line or page boundary. + // Helper methods to check if chunk starts at a line or page boundary. __attribute__((always_inline)) static bool isLineStart(Chunk_t chunk) { return isLineStart(chunk.addr); } @@ -312,7 +312,7 @@ template class SimpleDictionary { void refine(unsigned newLgGrainsize) { cilksan_assert(newLgGrainsize < getLgGrainsize() && "Invalid grainsize for refining Line_t."); - // If Data hasn't been materialzed yet, then just update LgGrainsize. + // If Data hasn't been materialized yet, then just update LgGrainsize. if (!isMaterialized()) { setLgGrainsize(newLgGrainsize); return; @@ -382,7 +382,7 @@ template class SimpleDictionary { // Get the grainsize of the access. unsigned AccessedLgGrainsize = Accessed.getLgGrainsize(); - // If we're overwritting the entire line, then we can coalesce the line. + // If we're overwriting the entire line, then we can coalesce the line. if (AccessedLgGrainsize == LG_LINE_SIZE) { // Reset the line if necessary. if (getLgGrainsize() != LG_LINE_SIZE) diff --git a/cilksan/spbag.h b/cilksan/spbag.h index aa68540..9dfbb10 100644 --- a/cilksan/spbag.h +++ b/cilksan/spbag.h @@ -80,14 +80,14 @@ class SPBagInterface { if (!that->get_ds()) return; - // cilksan_assert(that->_ds && "No disjointset node with that bag."); + // cilksan_assert(that->_ds && "No disjoint set node with that bag."); if (!_ds) { that->get_ds()->inc_ref_count(); _ds = that->get_ds(); return; } - cilksan_assert(_ds && "No disjointset node with this bag."); + cilksan_assert(_ds && "No disjoint set node with this bag."); set_ds(_ds->combine(that->get_ds())); } }; diff --git a/cilkscale/benchmark.cpp b/cilkscale/benchmark.cpp index af03bea..1d5708a 100644 --- a/cilkscale/benchmark.cpp +++ b/cilkscale/benchmark.cpp @@ -97,7 +97,7 @@ class BenchmarkImplT { // Top-level benchmarking tool. static BenchmarkImplT *createTool(void) { - // Ordered dynamic initalization should ensure that it's safe to create the + // Ordered dynamic initialization should ensure that it's safe to create the // tool. return new BenchmarkImplT(getenv("CILKSCALE_OUT")); } diff --git a/cilkscale/cilkscale.cpp b/cilkscale/cilkscale.cpp index be23d92..48a5076 100644 --- a/cilkscale/cilkscale.cpp +++ b/cilkscale/cilkscale.cpp @@ -71,7 +71,7 @@ class CilkscaleImplT { // Top-level Cilkscale tool. static CilkscaleImplT *createTool(void) { - // Ordered dynamic initalization should ensure that it's safe to create the + // Ordered dynamic initialization should ensure that it's safe to create the // tool. return new CilkscaleImplT(getenv("CILKSCALE_OUT")); } diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 1f9ce9c..735bed6 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -288,20 +288,20 @@ if(APPLE) # Note: In order to target x86_64h on OS X the minimum deployment target must # be 10.8 or higher. - set(DEFAULT_SANITIZER_MIN_OSX_VERSION 10.14) + set(DEFAULT_CILKTOOLS_MIN_OSX_VERSION 11) set(DARWIN_osx_MIN_VER_FLAG "-mmacosx-version-min") - if(NOT SANITIZER_MIN_OSX_VERSION) + if(NOT CILKTOOLS_MIN_OSX_VERSION) string(REGEX MATCH "${DARWIN_osx_MIN_VER_FLAG}=([.0-9]+)" MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}") if(MACOSX_VERSION_MIN_FLAG) - set(SANITIZER_MIN_OSX_VERSION "${CMAKE_MATCH_1}") + set(CILKTOOLS_MIN_OSX_VERSION "${CMAKE_MATCH_1}") elseif(CMAKE_OSX_DEPLOYMENT_TARGET) - set(SANITIZER_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET}) + set(CILKTOOLS_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET}) else() - set(SANITIZER_MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION}) + set(CILKTOOLS_MIN_OSX_VERSION ${DEFAULT_CILKTOOLS_MIN_OSX_VERSION}) endif() - if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7") - message(FATAL_ERROR "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too old.") + if(CILKTOOLS_MIN_OSX_VERSION VERSION_LESS "10.7") + message(FATAL_ERROR "macOS deployment target '${CILKTOOLS_MIN_OSX_VERSION}' is too old.") endif() endif() @@ -321,10 +321,10 @@ if(APPLE) set(DARWIN_osx_CFLAGS ${DARWIN_COMMON_CFLAGS} - ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION}) + ${DARWIN_osx_MIN_VER_FLAG}=${CILKTOOLS_MIN_OSX_VERSION}) set(DARWIN_osx_LINK_FLAGS ${DARWIN_COMMON_LINK_FLAGS} - ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION}) + ${DARWIN_osx_MIN_VER_FLAG}=${CILKTOOLS_MIN_OSX_VERSION}) if(DARWIN_osx_SYSROOT) list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})