Skip to content

Commit

Permalink
Add ARM build configs for latest gcc/clang. (#468)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Schellenberger Costa <[email protected]>
  • Loading branch information
jrhemstad and miscco authored Oct 17, 2023
1 parent a3faeb1 commit bb74b1a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dispatch-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
include: ${{ fromJSON(inputs.per_cuda_compiler_matrix) }}
with:
cpu: ${{ matrix.cpu }}
test_name: ${{matrix.compiler.name}}${{matrix.compiler.version}}/C++${{matrix.std}}
test_name: ${{matrix.cpu}}/${{matrix.compiler.name}}${{matrix.compiler.version}}/C++${{matrix.std}}
build_script: "./ci/build_${{ inputs.project_name }}.sh -cxx ${{matrix.compiler.exe}} -std ${{matrix.std}}"
test_script: "./ci/test_${{ inputs.project_name }}.sh -cxx ${{matrix.compiler.exe}} -std ${{matrix.std}}"
container_image: rapidsai/devcontainers:${{inputs.devcontainer_version}}-cpp-${{matrix.compiler.name}}${{matrix.compiler.version}}-cuda${{matrix.cuda}}-${{matrix.os}}
Expand All @@ -37,6 +37,6 @@ jobs:
matrix:
include: ${{ fromJSON(inputs.per_cuda_compiler_matrix) }}
with:
test_name: ${{matrix.compiler.name}}${{matrix.compiler.version}}/C++${{matrix.std}}
test_name: ${{matrix.cpu}}/${{matrix.compiler.name}}${{matrix.compiler.version}}/C++${{matrix.std}}
build_script: "./ci/windows/build_${{ inputs.project_name }}.ps1 ${{matrix.std}}"
container_image: rapidsai/devcontainers:${{inputs.devcontainer_version}}-cuda${{matrix.cuda}}-${{matrix.compiler.name}}${{matrix.compiler.version}}-${{matrix.os}}
2 changes: 2 additions & 0 deletions ci/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pull_request:
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'gcc', version: '10', exe: 'g++'}, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'gcc', version: '11', exe: 'g++'}, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'gcc', version: '12', exe: 'g++'}, std: [11, 14, 17, 20], jobs: ['build', 'test']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'arm64', compiler: {name: 'gcc', version: '12', exe: 'g++'}, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'ubuntu18.04', cpu: 'amd64', compiler: {name: 'llvm', version: '9', exe: 'clang++'}, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '9', exe: 'clang++'}, std: [11, 14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '10', exe: 'clang++'}, std: [11, 14, 17], jobs: ['build']}
Expand All @@ -44,6 +45,7 @@ pull_request:
- {cuda: *cuda_newest, os: 'ubuntu20.04', cpu: 'amd64', compiler: {name: 'llvm', version: '14', exe: 'clang++'}, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'llvm', version: '15', exe: 'clang++'}, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'amd64', compiler: {name: 'llvm', version: '16', exe: 'clang++'}, std: [11, 14, 17, 20], jobs: ['build', 'test']}
- {cuda: *cuda_newest, os: 'ubuntu22.04', cpu: 'arm64', compiler: {name: 'llvm', version: '16', exe: 'clang++'}, std: [11, 14, 17, 20], jobs: ['build']}
- {cuda: *cuda_oldest, os: 'windows2022', cpu: 'amd64', compiler: {name: 'cl', version: '14.16', exe: 'cl++'}, std: [14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'windows2022', cpu: 'amd64', compiler: {name: 'cl', version: '14.29', exe: 'cl++'}, std: [14, 17], jobs: ['build']}
- {cuda: *cuda_newest, os: 'windows2022', cpu: 'amd64', compiler: {name: 'cl', version: '14.36', exe: 'cl++'}, std: [14, 17, 20], jobs: ['build']}
Expand Down
19 changes: 17 additions & 2 deletions thrust/testing/functional.cu
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@

THRUST_DISABLE_MSVC_POSSIBLE_LOSS_OF_DATA_WARNING_BEGIN

// There is a unfortunate miscompilation of the gcc-12 vectorizer leading to OOB writes
// Adding this attribute suffices that this miscompilation does not appear anymore
#if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) && __GNUC__ >= 12 && THRUST_CPP_DIALECT >= 2020
#define THRUST_DISABLE_BROKEN_GCC_VECTORIZER __attribute__((optimize("no-tree-vectorize")))
#else
#define THRUST_DISABLE_BROKEN_GCC_VECTORIZER
#endif

const size_t NUM_SAMPLES = 10000;

template <class InputVector, class OutputVector, class Operator, class ReferenceOperator>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestUnaryFunctional(void)
{
typedef typename InputVector::value_type InputType;
Expand All @@ -28,6 +37,7 @@ void TestUnaryFunctional(void)
}

template <class InputVector, class OutputVector, class Operator, class ReferenceOperator>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestBinaryFunctional(void)
{
typedef typename InputVector::value_type InputType;
Expand All @@ -51,8 +61,6 @@ void TestBinaryFunctional(void)
ASSERT_ALMOST_EQUAL(output, std_output);
}



// XXX add bool to list
// Instantiate a macro for all integer-like data types
#define INSTANTIATE_INTEGER_TYPES(Macro, vector_type, operator_name) \
Expand Down Expand Up @@ -175,6 +183,7 @@ DECLARE_UNARY_LOGICAL_FUNCTIONAL_UNITTEST(logical_not, LogicalNot);

// Ad-hoc testing for other functionals
template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestIdentityFunctional(void)
{
typedef typename Vector::value_type T;
Expand All @@ -191,6 +200,7 @@ void TestIdentityFunctional(void)
DECLARE_VECTOR_UNITTEST(TestIdentityFunctional);

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestProject1stFunctional(void)
{
typedef typename Vector::value_type T;
Expand All @@ -211,6 +221,7 @@ void TestProject1stFunctional(void)
DECLARE_VECTOR_UNITTEST(TestProject1stFunctional);

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestProject2ndFunctional(void)
{
typedef typename Vector::value_type T;
Expand All @@ -231,6 +242,7 @@ void TestProject2ndFunctional(void)
DECLARE_VECTOR_UNITTEST(TestProject2ndFunctional);

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestMaximumFunctional(void)
{
typedef typename Vector::value_type T;
Expand All @@ -255,6 +267,7 @@ void TestMaximumFunctional(void)
DECLARE_VECTOR_UNITTEST(TestMaximumFunctional);

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestMinimumFunctional(void)
{
typedef typename Vector::value_type T;
Expand All @@ -279,6 +292,7 @@ void TestMinimumFunctional(void)
DECLARE_VECTOR_UNITTEST(TestMinimumFunctional);

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestNot1(void)
{
typedef typename Vector::value_type T;
Expand Down Expand Up @@ -314,6 +328,7 @@ DECLARE_INTEGRAL_VECTOR_UNITTEST(TestNot1);
THRUST_CPP_DIALECT == 2011)

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestNot2(void)
{
typedef typename Vector::value_type T;
Expand Down
27 changes: 27 additions & 0 deletions thrust/testing/transform.cu
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
#include <thrust/iterator/zip_iterator.h>
#include <thrust/iterator/retag.h>

// There is a unfortunate miscompilation of the gcc-12 vectorizer leading to OOB writes
// Adding this attribute suffices that this miscompilation does not appear anymore
#if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) && __GNUC__ >= 12 && THRUST_CPP_DIALECT >= 2020
#define THRUST_DISABLE_BROKEN_GCC_VECTORIZER __attribute__((optimize("no-tree-vectorize")))
#else
#define THRUST_DISABLE_BROKEN_GCC_VECTORIZER
#endif

template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformUnarySimple(void)
{
typedef typename Vector::value_type T;
Expand Down Expand Up @@ -78,6 +86,7 @@ DECLARE_UNITTEST(TestTransformUnaryDispatchImplicit);


template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfUnaryNoStencilSimple(void)
{
typedef typename Vector::value_type T;
Expand Down Expand Up @@ -166,6 +175,7 @@ DECLARE_UNITTEST(TestTransformIfUnaryNoStencilDispatchImplicit);


template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfUnarySimple(void)
{
typedef typename Vector::value_type T;
Expand Down Expand Up @@ -259,6 +269,7 @@ DECLARE_UNITTEST(TestTransformIfUnaryDispatchImplicit);


template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformBinarySimple(void)
{
typedef typename Vector::value_type T;
Expand Down Expand Up @@ -339,6 +350,7 @@ DECLARE_UNITTEST(TestTransformBinaryDispatchImplicit);


template <class Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfBinarySimple(void)
{
typedef typename Vector::value_type T;
Expand Down Expand Up @@ -447,6 +459,7 @@ DECLARE_UNITTEST(TestTransformIfBinaryDispatchImplicit);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformUnary(const size_t n)
{
thrust::host_vector<T> h_input = unittest::random_integers<T>(n);
Expand All @@ -464,6 +477,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformUnary);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformUnaryToDiscardIterator(const size_t n)
{
thrust::host_vector<T> h_input = unittest::random_integers<T>(n);
Expand Down Expand Up @@ -495,6 +509,7 @@ struct repeat2


template<typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformUnaryToDiscardIteratorZipped(const size_t n)
{
thrust::host_vector<T> h_input = unittest::random_integers<T>(n);
Expand Down Expand Up @@ -542,6 +557,7 @@ struct is_positive


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfUnaryNoStencil(const size_t n)
{
thrust::host_vector<T> h_input = unittest::random_integers<T>(n);
Expand All @@ -564,6 +580,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformIfUnaryNoStencil);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfUnary(const size_t n)
{
thrust::host_vector<T> h_input = unittest::random_integers<T>(n);
Expand All @@ -590,6 +607,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformIfUnary);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfUnaryToDiscardIterator(const size_t n)
{
thrust::host_vector<T> h_input = unittest::random_integers<T>(n);
Expand Down Expand Up @@ -619,6 +637,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformIfUnaryToDiscardIterator);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformBinary(const size_t n)
{
thrust::host_vector<T> h_input1 = unittest::random_integers<T>(n);
Expand All @@ -643,6 +662,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformBinary);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformBinaryToDiscardIterator(const size_t n)
{
thrust::host_vector<T> h_input1 = unittest::random_integers<T>(n);
Expand All @@ -664,6 +684,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformBinaryToDiscardIterator);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfBinary(const size_t n)
{
thrust::host_vector<T> h_input1 = unittest::random_integers<T>(n);
Expand Down Expand Up @@ -711,6 +732,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformIfBinary);


template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformIfBinaryToDiscardIterator(const size_t n)
{
thrust::host_vector<T> h_input1 = unittest::random_integers<T>(n);
Expand Down Expand Up @@ -745,6 +767,7 @@ DECLARE_VARIABLE_UNITTEST(TestTransformIfBinaryToDiscardIterator);

#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) == 40400) || defined(__INTEL_COMPILER)
template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformUnaryCountingIterator()
{
// G++ 4.4.x has a known failure with auto-vectorization (due to -O3 or
Expand All @@ -758,6 +781,7 @@ void TestTransformUnaryCountingIterator()
}
#else
template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformUnaryCountingIterator()
{
size_t const n = 15 * sizeof(T);
Expand All @@ -780,6 +804,7 @@ DECLARE_GENERIC_UNITTEST(TestTransformUnaryCountingIterator);

#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) == 40400
template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformBinaryCountingIterator()
{
// GCC 4.4.x has a known failure with auto-vectorization (due to -O3 or -ftree-vectorize) of this test
Expand All @@ -789,6 +814,7 @@ void TestTransformBinaryCountingIterator()
}
#else
template <typename T>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformBinaryCountingIterator()
{
size_t const n = 15 * sizeof(T);
Expand Down Expand Up @@ -825,6 +851,7 @@ struct plus_mod3
};

template <typename Vector>
THRUST_DISABLE_BROKEN_GCC_VECTORIZER
void TestTransformWithIndirection(void)
{
// add numbers modulo 3 with external lookup table
Expand Down

0 comments on commit bb74b1a

Please sign in to comment.