Skip to content

Commit 5ff4111

Browse files
committed
cpp
1 parent 5c8dfd1 commit 5ff4111

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

native/src/mlxsharp.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,23 @@
2020
#include <mlx/stream.h>
2121
#include <mlx/transforms.h>
2222

23-
namespace {
24-
25-
thread_local std::string g_last_error;
26-
27-
constexpr const char* kNullContext = "Context pointer is null.";
28-
constexpr const char* kNullArray = "Array pointer is null.";
29-
constexpr const char* kNullOutParameter = "Output parameter is null.";
30-
constexpr const char* kShapeMismatch = "Element count does not match provided shape.";
31-
constexpr const char* kNonContiguous = "Array data is not contiguous.";
32-
constexpr const char* kUnsupportedDType = "Unsupported dtype.";
33-
34-
struct mlxsharp_context final {
23+
struct mlxsharp_context {
3524
std::atomic<int32_t> ref_count{1};
3625
mlx::core::Device device;
3726

3827
explicit mlxsharp_context(const mlx::core::Device& d)
3928
: device(d) {}
4029
};
4130

42-
struct mlxsharp_array final {
31+
struct mlxsharp_array {
4332
std::atomic<int32_t> ref_count{1};
4433
mlx::core::array value;
4534

4635
explicit mlxsharp_array(mlx::core::array v)
4736
: value(std::move(v)) {}
4837
};
4938

50-
struct mlxsharp_session final {
39+
struct mlxsharp_session {
5140
std::atomic<int32_t> ref_count{1};
5241
mlxsharp_context_t* context;
5342
std::string chat_model;
@@ -61,6 +50,17 @@ struct mlxsharp_session final {
6150
image_model(std::move(image)) {}
6251
};
6352

53+
namespace {
54+
55+
thread_local std::string g_last_error;
56+
57+
constexpr const char* kNullContext = "Context pointer is null.";
58+
constexpr const char* kNullArray = "Array pointer is null.";
59+
constexpr const char* kNullOutParameter = "Output parameter is null.";
60+
constexpr const char* kShapeMismatch = "Element count does not match provided shape.";
61+
constexpr const char* kNonContiguous = "Array data is not contiguous.";
62+
constexpr const char* kUnsupportedDType = "Unsupported dtype.";
63+
6464
static void assign_usage(mlx_usage* usage, int input_tokens, int output_tokens)
6565
{
6666
if (usage != nullptr)

0 commit comments

Comments
 (0)