diff --git a/mlx/array.h b/mlx/array.h index 7325a1e76..1f04d8ff8 100644 --- a/mlx/array.h +++ b/mlx/array.h @@ -1,5 +1,6 @@ // Copyright © 2023 Apple Inc. #pragma once + #include #include #include @@ -362,7 +363,7 @@ class array { std::vector strides; size_t size; Dtype dtype; - std::shared_ptr primitive{nullptr}; + std::shared_ptr primitive; // Indicates an array is being used in a graph transform // and should not be detached from the graph @@ -370,7 +371,7 @@ class array { // This is a shared pointer so that *different* arrays // can share the underlying data buffer. - std::shared_ptr data{nullptr}; + std::shared_ptr data; // Properly offset data pointer void* data_ptr{nullptr}; @@ -409,7 +410,7 @@ class array { // shape, strides, the data type. It also includes // the primitive which knows how to compute the array's data from its inputs // and the list of array's inputs for the primitive. - std::shared_ptr array_desc_{nullptr}; + std::shared_ptr array_desc_; }; template diff --git a/mlx/backend/metal/device.cpp b/mlx/backend/metal/device.cpp index 1fb2bd46f..a2966362f 100644 --- a/mlx/backend/metal/device.cpp +++ b/mlx/backend/metal/device.cpp @@ -20,9 +20,9 @@ namespace mlx::core::metal { namespace { // TODO nicer way to set this or possibly expose as an environment variable -static constexpr int MAX_BUFFERS_PER_QUEUE = 12; +constexpr int MAX_BUFFERS_PER_QUEUE = 12; -static constexpr const char* default_mtllib_path = METAL_PATH; +constexpr const char* default_mtllib_path = METAL_PATH; auto load_device() { auto devices = MTL::CopyAllDevices(); diff --git a/mlx/backend/metal/indexing.cpp b/mlx/backend/metal/indexing.cpp index 13169c4f1..67095a021 100644 --- a/mlx/backend/metal/indexing.cpp +++ b/mlx/backend/metal/indexing.cpp @@ -16,7 +16,7 @@ namespace mlx::core { namespace { -static constexpr int METAL_MAX_INDEX_ARRAYS = 10; +constexpr int METAL_MAX_INDEX_ARRAYS = 10; } // namespace diff --git a/mlx/backend/metal/primitives.cpp b/mlx/backend/metal/primitives.cpp index 686c35d7f..6908b6905 100644 --- a/mlx/backend/metal/primitives.cpp +++ b/mlx/backend/metal/primitives.cpp @@ -17,7 +17,7 @@ namespace mlx::core { namespace { -static constexpr int METAL_MAX_INDEX_ARRAYS = 10; +constexpr int METAL_MAX_INDEX_ARRAYS = 10; void binary_op( const std::vector& inputs, diff --git a/mlx/dtype.cpp b/mlx/dtype.cpp index 99b75a028..b4ac9159d 100644 --- a/mlx/dtype.cpp +++ b/mlx/dtype.cpp @@ -11,9 +11,9 @@ namespace mlx::core { namespace { -static constexpr int num_types = 13; +constexpr int num_types = 13; -static constexpr Dtype::Kind type_kinds[num_types] = { +constexpr Dtype::Kind type_kinds[num_types] = { Dtype::Kind::b, // bool_, Dtype::Kind::u, // uint8, Dtype::Kind::u, // uint16, @@ -32,7 +32,7 @@ static constexpr Dtype::Kind type_kinds[num_types] = { // Following Jax type promotion rules: // https://jax.readthedocs.io/en/latest/type_promotion.html // clang-format off -static constexpr Dtype type_rules[num_types][num_types] = { +constexpr Dtype type_rules[num_types][num_types] = { // bool uint8 uint16 uint32 uint64 int8 int16 int32 int64 float16 float32 bfloat16 complex64 {bool_, uint8, uint16, uint32, uint64, int8, int16, int32, int64, float16, float32, bfloat16, complex64}, // bool {uint8, uint8, uint16, uint32, uint64, int16, int16, int32, int64, float16, float32, bfloat16, complex64}, // uint8 diff --git a/mlx/io/load.cpp b/mlx/io/load.cpp index fa3d13377..9d88f87fe 100644 --- a/mlx/io/load.cpp +++ b/mlx/io/load.cpp @@ -18,7 +18,7 @@ namespace mlx::core { namespace { -static constexpr uint8_t MAGIC[] = { +constexpr uint8_t MAGIC[] = { 0x93, 0x4e, 0x55, diff --git a/mlx/transforms.cpp b/mlx/transforms.cpp index 695159a57..88581c52d 100644 --- a/mlx/transforms.cpp +++ b/mlx/transforms.cpp @@ -118,7 +118,7 @@ void eval(const std::vector& outputs) { arr_deps.push_back(it->second); } } - std::shared_ptr> p{nullptr}; + std::shared_ptr> p; if (auto it = deps.find(arr.primitive_id()); it != deps.end()) { p = std::make_unique>(); ps.push_back(p);