Skip to content

Commit 52ef611

Browse files
authored
Bump Mojmelo for MAX 25.5 (#165)
1 parent be24a87 commit 52ef611

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

recipes/mojmelo/recipe.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
context:
2-
version: "0.0.75"
2+
version: "0.0.8"
33

44
package:
55
name: "mojmelo"
66
version: ${{ version }}
77

88
source:
99
- git: https://github.com/yetalit/mojmelo.git
10-
rev: db1118cbb1eb845de10012d72113080d15f0d9c6
10+
rev: 04f2b8b4c2a8e495b8e05ad7d7554e1b644df66d
1111

1212
build:
1313
number: 0
@@ -16,7 +16,7 @@ build:
1616
- mojo package pixi/mojmelo -o ${{ PREFIX }}/lib/mojo/mojmelo.mojopkg
1717
requirements:
1818
host:
19-
- max =25.4
19+
- max =25.5
2020
run:
2121
- ${{ pin_compatible('max') }}
2222

@@ -27,7 +27,7 @@ tests:
2727
- mojo tests/setup.mojo
2828
requirements:
2929
run:
30-
- max =25.4
30+
- max =25.5
3131
files:
3232
recipe:
3333
- tests/setup.mojo

recipes/mojmelo/tests/mojmelo/utils/Matrix.mojo

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .mojmelo_matmul import matmul
2-
from memory import memcpy, memset_zero, UnsafePointer
2+
from memory import memcpy, memset_zero
33
import random
44

55
struct Matrix(Copyable, Movable, Sized):
@@ -37,15 +37,15 @@ struct Matrix(Copyable, Movable, Sized):
3737
self.order = other.order
3838
memcpy(self.data, other.data, self.size)
3939

40-
fn __moveinit__(out self, owned existing: Self):
40+
fn __moveinit__(out self, var existing: Self):
4141
self.height = existing.height
4242
self.width = existing.width
4343
self.size = existing.size
4444
self.data = existing.data
4545
self.order = existing.order
46-
existing.height = existing.width = existing.size = 0
47-
existing.order = ''
48-
existing.data = UnsafePointer[Float32]()
46+
#existing.height = existing.width = existing.size = 0
47+
#existing.order = ''
48+
#existing.data = UnsafePointer[Float32]()
4949

5050
# access an element
5151
@always_inline
@@ -60,7 +60,7 @@ struct Matrix(Copyable, Movable, Sized):
6060
return self.data[loc]
6161

6262
@always_inline
63-
fn __del__(owned self):
63+
fn __del__(var self):
6464
if self.data:
6565
self.data.free()
6666

recipes/mojmelo/tests/mojmelo/utils/mojmelo_matmul/matmul.mojo

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
from algorithm import vectorize, parallelize
44
from memory.memory import _malloc, stack_allocation
5-
from memory import UnsafePointer
6-
from sys import has_avx512f, num_performance_cores, simdwidthof, sizeof
5+
from sys import CompilationTarget, num_performance_cores, simdwidthof, sizeof
76
import benchmark
87
from testing import assert_equal
98
from utils import IndexList
@@ -33,9 +32,8 @@ fn intsqrt[n: Int]() -> Int:
3332
return x
3433

3534

36-
@value
3735
@register_passable("trivial")
38-
struct Layout(Writable):
36+
struct Layout(Copyable, Movable, Writable):
3937
var shape: IndexList[2]
4038
var strides: IndexList[2]
4139

@@ -70,7 +68,7 @@ struct Matrix[Type: DType]:
7068

7169
@always_inline("nodebug")
7270
fn __init__(
73-
out self, data: UnsafePointer[Scalar[Type]], owned layout: Layout
71+
out self, data: UnsafePointer[Scalar[Type]], var layout: Layout
7472
):
7573
self.data = UnsafePointer[Scalar[Type]](data)
7674
self.layout = layout
@@ -445,7 +443,7 @@ fn matmul_params[Type: DType]() -> IndexList[5]:
445443
alias mc = 8192 // sizeof[Type]() # fix this for simplicity
446444
alias N = simdwidthof[Type]()
447445

448-
alias Vectors = 32 if has_avx512f() else 16
446+
alias Vectors = 32 if CompilationTarget.has_avx512f() else 16
449447

450448
@parameter
451449
fn compute_kc[mr: Int, nr: Int]() -> Int:
@@ -474,7 +472,7 @@ fn matmul_params[Type: DType]() -> IndexList[5]:
474472
if Type is DType.int64:
475473

476474
@parameter
477-
if has_avx512f():
475+
if CompilationTarget.has_avx512f():
478476
alias TempVectors = 2
479477
return compute_params[Vectors - TempVectors]()
480478
else:

recipes/mojmelo/tests/setup.mojo

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from sys import external_call, os_is_linux, os_is_macos, argv
1+
from sys import external_call, CompilationTarget, argv
22
from sys.ffi import *
3-
from memory import UnsafePointer
43

54
fn cachel1() -> Int32:
65
var l1_cache_size: c_int = 0
@@ -93,7 +92,7 @@ fn main() raises:
9392
cache_l2_size = 0
9493
cache_l1_associativity = 0
9594
cache_l2_associativity = 0
96-
if os_is_linux():
95+
if CompilationTarget.is_linux():
9796
with open("/sys/devices/system/cpu/cpu0/cache/index0/size", "r") as f:
9897
txt = f.read()
9998
if txt.find('K') != -1:
@@ -116,7 +115,7 @@ fn main() raises:
116115
cache_l2_associativity = atol(f.read())
117116
except:
118117
cache_l2_associativity = 0
119-
elif os_is_macos():
118+
elif CompilationTarget.is_macos():
120119
cache_l1_size = Int(cachel1())
121120
cache_l2_size = Int(cachel2())
122121
initialize(cache_l1_size, cache_l1_associativity, cache_l2_size, cache_l2_associativity)

0 commit comments

Comments
 (0)