Skip to content

Commit

Permalink
Buckify breeze (#11512)
Browse files Browse the repository at this point in the history
Summary:
Breeze is a new library developed by Rivos for cross platform SIMT acceleration. We keep it inside Velox so that it can be co-evolved with Velox.

Pull Request resolved: #11512

bypass-github-export-checks

Reviewed By: oerling

Differential Revision: D65797319

fbshipit-source-id: 2045449d3d7b2f32ba1079dec655d13f0f412138
  • Loading branch information
Yuhta authored and facebook-github-bot committed Nov 14, 2024
1 parent f37dc00 commit c069192
Show file tree
Hide file tree
Showing 39 changed files with 803 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

#pragma once

#include "functions/load.h"
#include "functions/reduce.h"
#include "platforms/platform.h"
#include "utils/block_details.h"
#include "utils/types.h"
#include "breeze/functions/load.h"
#include "breeze/functions/reduce.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/block_details.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace algorithms {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

#pragma once

#include "functions/load.h"
#include "functions/scan.h"
#include "functions/store.h"
#include "platforms/platform.h"
#include "utils/block_details.h"
#include "utils/types.h"
#include "breeze/functions/load.h"
#include "breeze/functions/scan.h"
#include "breeze/functions/store.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/block_details.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace algorithms {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

#pragma once

#include "functions/sort.h"
#include "platforms/platform.h"
#include "utils/block_details.h"
#include "utils/types.h"
#include "breeze/functions/sort.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/block_details.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace algorithms {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#pragma once

#include "platforms/platform.h"
#include "utils/types.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace functions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#pragma once

#include "platforms/platform.h"
#include "utils/types.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace functions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#pragma once

#include "platforms/platform.h"
#include "utils/types.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace functions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

#pragma once

#include "functions/load.h"
#include "functions/scan.h"
#include "functions/store.h"
#include "platforms/platform.h"
#include "utils/types.h"
#include "breeze/functions/load.h"
#include "breeze/functions/scan.h"
#include "breeze/functions/store.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace functions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#pragma once

#include "platforms/platform.h"
#include "utils/types.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/types.h"

namespace breeze {
namespace functions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <cuda.h>

#include "utils/types.h"
#include "breeze/utils/types.h"

struct CudaSpecialization {
template <int WARP_THREADS>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <metal_stdlib>

#include "utils/types.h"
#include "breeze/utils/types.h"

struct MetalSpecialization {
template <typename SliceT, typename T = typename SliceT::data_type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ struct OpenMPPlatform {
inline unsigned lower_rank_lanemask() {
static_assert(WARP_THREADS <= sizeof(unsigned) * 8,
"WARP_THREADS must be less or equal to unsigned bits");
return (1 << lane_idx()) - 1;
return (1u << lane_idx()) - 1;
}
inline unsigned higher_rank_lanemask() {
static_assert(WARP_THREADS <= sizeof(unsigned) * 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <CL/sycl.hpp>
#pragma GCC diagnostic pop

#include "utils/types.h"
#include "breeze/utils/types.h"

template <int SYCL_BLOCK_THREADS, int SYCL_WARP_THREADS>
struct SyCLPlatform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma once

#include "platforms/platform.h"
#include "breeze/platforms/platform.h"

namespace breeze {
namespace utils {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <new>

#ifdef __EXCEPTIONS
#include "utils/types.h"
#include "breeze/utils/types.h"
#else
#include <iostream>
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <cuda.h>

#include "utils/device_allocator.h"
#include "breeze/utils/device_allocator.h"

namespace breeze {
namespace utils {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma once

#include "platforms/platform.h"
#include "breeze/platforms/platform.h"

#ifdef __EXCEPTIONS
#include <exception>
Expand Down Expand Up @@ -166,7 +166,7 @@ class BadDeviceAlloc : public std::exception {
",free=" + std::to_string(free) +
",total=" + std::to_string(total) + ")") {}

virtual const char *what() const throw() { return message_.c_str(); }
virtual const char *what() const noexcept { return message_.c_str(); }

private:
std::string message_;
Expand Down
2 changes: 0 additions & 2 deletions velox/experimental/breeze/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

include_directories(${CMAKE_SOURCE_DIR}/test ${CMAKE_SOURCE_DIR})

cxx_library(test_main "${cxx_strict}" test_main.cpp)
target_link_libraries(
test_main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
#define PLATFORM(X) [[clang::annotate("PlatformName=" X)]]
#define SHARED_MEM(T, id) [[clang::annotate("SharedMem=" T ";" id)]]

#include "algorithms/reduce.h"
#include "algorithms/scan.h"
#include "algorithms/sort.h"
#include "platforms/platform.h"
#include "utils/types.h"
#include "breeze/algorithms/reduce.h"
#include "breeze/algorithms/scan.h"
#include "breeze/algorithms/sort.h"
#include "breeze/platforms/platform.h"
#include "breeze/utils/types.h"

namespace kernels {

Expand Down
12 changes: 6 additions & 6 deletions velox/experimental/breeze/test/algorithms/algorithm_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
*/

#if defined(PLATFORM_CUDA)
#include "generated/algorithms/algorithm_test-cuda.cuh"
#include "test/generated/algorithms/algorithm_test-cuda.cuh"
#elif defined(PLATFORM_HIP)
#include "generated/algorithms/algorithm_test-hip.hpp"
#include "test/generated/algorithms/algorithm_test-hip.hpp"
#elif defined(PLATFORM_SYCL)
#include "generated/algorithms/algorithm_test-sycl.hpp"
#include "test/generated/algorithms/algorithm_test-sycl.hpp"
#elif defined(PLATFORM_OPENCL)
#include "generated/algorithms/algorithm_test-opencl.h"
#include "test/generated/algorithms/algorithm_test-opencl.h"
#elif defined(PLATFORM_OPENMP)
#include "generated/algorithms/algorithm_test-openmp.h"
#include "test/generated/algorithms/algorithm_test-openmp.h"
#elif defined(PLATFORM_METAL)
#include "generated/algorithms/algorithm_test-metal.h"
#include "test/generated/algorithms/algorithm_test-metal.h"
#else
#error unsupported platform
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
#define PLATFORM(X) [[clang::annotate("PlatformName=" X)]]
#define SHARED_MEM(T, id) [[clang::annotate("SharedMem=" T ";" id)]]

#include "functions/load.h"
#include "functions/reduce.h"
#include "functions/scan.h"
#include "functions/sort.h"
#include "functions/store.h"
#include "platforms/platform.h"
#include "breeze/functions/load.h"
#include "breeze/functions/reduce.h"
#include "breeze/functions/scan.h"
#include "breeze/functions/sort.h"
#include "breeze/functions/store.h"
#include "breeze/platforms/platform.h"

namespace kernels {

Expand Down
12 changes: 6 additions & 6 deletions velox/experimental/breeze/test/functions/function_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
*/

#if defined(PLATFORM_CUDA)
#include "generated/functions/function_test-cuda.cuh"
#include "test/generated/functions/function_test-cuda.cuh"
#elif defined(PLATFORM_HIP)
#include "generated/functions/function_test-hip.hpp"
#include "test/generated/functions/function_test-hip.hpp"
#elif defined(PLATFORM_SYCL)
#include "generated/functions/function_test-sycl.hpp"
#include "test/generated/functions/function_test-sycl.hpp"
#elif defined(PLATFORM_OPENCL)
#include "generated/functions/function_test-opencl.h"
#include "test/generated/functions/function_test-opencl.h"
#elif defined(PLATFORM_OPENMP)
#include "generated/functions/function_test-openmp.h"
#include "test/generated/functions/function_test-openmp.h"
#elif defined(PLATFORM_METAL)
#include "generated/functions/function_test-metal.h"
#include "test/generated/functions/function_test-metal.h"
#else
#error unsupported platform
#endif
32 changes: 32 additions & 0 deletions velox/experimental/breeze/test/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -efx -o pipefail
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
cd "$SCRIPTDIR"

function generate {
BACKEND=$1
TYPE=$2
EXT=$3
DIR="$TYPE"s
mkdir -p generated/"$DIR"
./kernel_generator.py --backend="$BACKEND" --template="$DIR"/"$TYPE"-kernels.template.h --out=generated/"$DIR"/kernels-"$BACKEND"."$EXT"
./test_fixture_generator.py --backend="$BACKEND" --template="$DIR"/"$TYPE"_test.template.h --out=generated/"$DIR"/"$TYPE"_test-"$BACKEND"."$EXT"
}

generate openmp "algorithm" h
generate openmp "function" h
Loading

0 comments on commit c069192

Please sign in to comment.