MCPcopy Create free account
hub / github.com/ml-explore/mlx / time_strided_ops

Function time_strided_ops

benchmarks/cpp/single_ops.cpp:112–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void time_strided_ops() {
113 int M = 50, N = 50, O = 50, P = 50;
114 auto a = mx::random::uniform({M, N, O, P});
115 auto b = mx::random::uniform({M, N, O, P});
116 auto device = mx::default_device();
117 mx::eval(a, b);
118 TIMEM("non-strided", mx::add, a, b, device);
119 a = mx::transpose(a, {1, 0, 2, 3});
120 b = mx::transpose(b, {3, 2, 0, 1});
121 mx::eval(a, b);
122 TIMEM("strided", mx::add, a, b, device);
123}
124
125void time_comparisons() {
126 int M = 1000, N = 100, K = 10;

Callers 1

mainFunction · 0.85

Calls 3

uniformFunction · 0.50
evalFunction · 0.50
transposeFunction · 0.50

Tested by

no test coverage detected