Skip to content

Commit a579ccf

Browse files
authored
Merge branch 'main' into main
2 parents c7f5d0a + 2984474 commit a579ccf

File tree

11 files changed

+171
-141
lines changed

11 files changed

+171
-141
lines changed

recipes/ExtraMojo/recipe.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
context:
2-
version: "0.17.0"
3-
mojo_version: "=25.5"
2+
version: "0.19.0"
3+
mojo_version: "=0.25.7"
44

55
package:
66
name: "extramojo"
77
version: ${{ version }}
88

99
source:
1010
- git: https://github.com/ExtraMojo/ExtraMojo.git
11-
rev: 608ca09f3b2e201b8c163f466966af48fa99e1c2
11+
rev: 6afbfc66b7d9840c82a20ea1090443934e31b673
1212
# path: .
1313
# use_gitignore: true
1414

@@ -28,8 +28,7 @@ tests:
2828
- script:
2929
- if: unix
3030
then:
31-
- mojo run -I . tests/test_file.mojo
32-
- mojo test -I . tests
31+
- sh -c 'find ./tests -name test_*.mojo | xargs -I % pixi run mojo run -I . -D ASSERT=all %'
3332
requirements:
3433
build:
3534
- mojo ${{ mojo_version }}

recipes/emberjson/recipe.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
context:
2-
version: 0.2.0
3-
mojo_version: "=0.25.6"
2+
version: 0.2.1
43

54
package:
65
name: "emberjson"
76
version: ${{ version }}
87

98
source:
109
- git: https://github.com/bgreni/EmberJson.git
11-
rev: 5a456cc8286753d3fcdc5686f0ec48fe2dcee316
10+
rev: 6c6ed09fba6c426546e099af886deb53824bb4ba
1211

1312
build:
1413
number: 0
@@ -17,22 +16,28 @@ build:
1716

1817
requirements:
1918
host:
20-
- mojo-compiler =0.25.6
19+
- mojo-compiler =0.25.7
2120
build:
22-
- mojo-compiler ${{ mojo_version }}
21+
- mojo-compiler =0.25.7
2322
run:
2423
- ${{ pin_compatible('mojo-compiler') }}
2524

2625
tests:
2726
- script:
2827
- if: unix
2928
then:
30-
- mojo test
29+
- python run_tests.py
30+
files:
31+
source:
32+
- run_tests.py
33+
- test/
34+
- emberjson/
35+
- bench_data/
3136
requirements:
3237
build:
33-
- mojo ${{ mojo_version }}
38+
- mojo =0.25.7
3439
run:
35-
- mojo ${{ mojo_version }}
40+
- mojo =0.25.7
3641

3742
about:
3843
homepage: https://github.com/bgreni/EmberJson

recipes/ish/recipe.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json
22

33
context:
4-
version: "1.3.0"
5-
modular_version: "=25.4"
6-
extramojo_version: "=0.15"
4+
version: "1.4.0"
5+
mojo_version: "=0.25.6"
6+
extramojo_version: "=0.18"
77

88

99
package:
@@ -12,9 +12,7 @@ package:
1212

1313
source:
1414
- git: https://github.com/BioRadOpenSource/ish.git
15-
rev: 0c88df6fab279b69f02b002bca35c2e3eecdc90e
16-
# path: .
17-
# use_gitignore: true
15+
rev: 304233bc80b14c18f6f1497d17116d2328d2474f
1816

1917
build:
2018
number: 0
@@ -29,12 +27,12 @@ build:
2927

3028
requirements:
3129
host:
32-
- modular ${{ modular_version }}
30+
- mojo-compiler ${{ mojo_version }}
3331
- extramojo ${{ extramojo_version }}
3432
- zlib >=1.3.1,<2
3533

3634
run:
37-
- modular ${{ modular_version }}
35+
- mojo-compiler ${{ mojo_version }}
3836
- zlib >=1.3.1,<2
3937

4038
tests:
@@ -44,7 +42,7 @@ tests:
4442
- mojo test -I ${{ PREFIX }}/share/mojo/ishlib.mojopkg tests
4543
requirements:
4644
run:
47-
- modular ${{ modular_version }}
45+
- mojo-compiler ${{ mojo_version }}
4846
- extramojo ${{ extramojo_version }}
4947
- zlib >=1.3.1,<2
5048

recipes/kelvin/recipe.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
context:
2-
version: 0.1.3
3-
mojo_version: "=0.25.6"
2+
version: 0.1.4
43

54
package:
65
name: "kelvin"
76
version: ${{ version }}
87

98
source:
109
- git: https://github.com/bgreni/Kelvin.git
11-
rev: d10f89ac05c178e7537906fb5834e10764f3291f
10+
rev: 3018ba56fa762a3090bbf4ca26438b6c506278ea
1211

1312
build:
1413
number: 0
@@ -17,24 +16,31 @@ build:
1716

1817
requirements:
1918
host:
20-
- mojo-compiler ${{ mojo_version }}
19+
- mojo-compiler =0.25.7
2120
build:
22-
- mojo-compiler ${{ mojo_version }}
21+
- mojo-compiler =0.25.7
2322
run:
2423
- ${{ pin_compatible('mojo-compiler') }}
2524

2625
tests:
2726
- script:
2827
- if: unix
2928
then:
30-
- mojo test
31-
# Can't convince PR build to find this file
32-
# - python3 scripts/run_reject_tests.py
29+
- python run_test.py
30+
- python scripts/generate_tests.py && python scripts/run_reject_tests.py
31+
32+
files:
33+
source:
34+
- kelvin/
35+
- test/
36+
- run_test.py
37+
- scripts/run_reject_tests.py
38+
- scripts/generate_tests.py
3339
requirements:
3440
build:
35-
- mojo ${{ mojo_version }}
41+
- mojo =0.25.7
3642
run:
37-
- mojo ${{ mojo_version }}
43+
- mojo =0.25.7
3844

3945
about:
4046
homepage: https://github.com/bgreni/Kelvin

recipes/lightbug_http/recipe.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json
2-
32
context:
4-
version: "25.4.0"
5-
3+
version: "0.25.6"
4+
mojo_version: "=0.25.6"
65
package:
76
name: "lightbug_http"
87
version: ${{ version }}
9-
108
source:
119
- git: https://github.com/saviorand/lightbug_http.git
12-
rev: 508f4210fd32af2010286625d8fbd69ef0534057
13-
10+
rev: b7b81a8332259fa14e1057dc86a8249c2e6df927
1411
build:
1512
number: 0
1613
script:
1714
- mkdir -p ${PREFIX}/lib/mojo
1815
- mojo package lightbug_http -o ${{ PREFIX }}/lib/mojo/lightbug_http.mojopkg
19-
2016
requirements:
17+
build:
18+
- mojo-compiler ${{ mojo_version }}
2119
host:
22-
- max =25.4
20+
- mojo-compiler ${{ mojo_version }}
2321
run:
24-
- ${{ pin_compatible('max') }}
25-
22+
- mojo-compiler ${{ mojo_version }}
2623
tests:
2724
- script:
2825
- if: unix
2926
then:
3027
- mojo test
3128
requirements:
29+
build:
30+
- mojo ${{ mojo_version }}
3231
run:
33-
- max =25.4
32+
- mojo ${{ mojo_version }}
3433
files:
3534
recipe:
3635
- tests/lightbug_http/io/test_bytes.mojo
@@ -40,14 +39,12 @@ tests:
4039
- tests/lightbug_http/test_http.mojo
4140
- tests/lightbug_http/test_net.mojo
4241
- tests/lightbug_http/test_uri.mojo
43-
4442
about:
4543
homepage: https://lightbug.site
4644
license: MIT
4745
license_file: LICENSE
4846
summary: Lightbug is a simple and sweet HTTP framework for Mojo
4947
repository: https://github.com/saviorand/lightbug_http
50-
5148
extra:
5249
maintainers:
5350
- saviorand

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.9"
2+
version: "0.1.0"
33

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

88
source:
99
- git: https://github.com/yetalit/mojmelo.git
10-
rev: dd4c87ee4d28d242ce57006182b248c6f95ad37a
10+
rev: 01692d2078e55f4dbeac981240edc620d0dc96af
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-
- mojo-compiler =0.25.6
19+
- mojo-compiler =0.25.7
2020
run:
2121
- ${{ pin_compatible('mojo-compiler') }}
2222

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

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

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,40 @@ struct Matrix(Copyable, Movable, ImplicitlyCopyable, Sized):
66
var height: Int
77
var width: Int
88
var size: Int
9-
var data: UnsafePointer[Float32]
9+
var data: UnsafePointer[Float32, MutAnyOrigin]
1010
var order: String
1111

1212
# initialize from UnsafePointer
1313
@always_inline
14-
fn __init__(out self, data: UnsafePointer[Float32], height: Int, width: Int, order: String = 'c'):
14+
fn __init__[src: DType = DType.float32](out self, data: UnsafePointer[Scalar[src], MutAnyOrigin], height: Int, width: Int, order: String = 'c'):
1515
self.height = height
1616
self.width = width
1717
self.size = height * width
18-
self.data = data
18+
if src == DType.float32:
19+
self.data = data.bitcast[Float32]()
20+
else:
21+
self.data = cast[src=src, des=DType.float32, width=self.simd_width](data, self.size)
22+
data.free()
1923
self.order = order.lower()
2024

2125
# initialize by copying from UnsafePointer
2226
@always_inline
23-
fn __init__(out self, height: Int, width: Int, data: UnsafePointer[Float32] = UnsafePointer[Float32](), order: String = 'c'):
27+
fn __init__(out self, height: Int, width: Int, data: UnsafePointer[Float32, MutAnyOrigin] = UnsafePointer[Float32, MutAnyOrigin](), order: String = 'c'):
2428
self.height = height
2529
self.width = width
2630
self.size = height * width
27-
self.data = UnsafePointer[Float32].alloc(self.size)
31+
self.data = alloc[Float32](self.size)
2832
self.order = order.lower()
2933
if data:
30-
memcpy(self.data, data, self.size)
34+
memcpy(dest=self.data, src=data, count=self.size)
3135

3236
fn __copyinit__(out self, other: Self):
3337
self.height = other.height
3438
self.width = other.width
3539
self.size = other.size
36-
self.data = UnsafePointer[Float32].alloc(self.size)
40+
self.data = alloc[Float32](self.size)
3741
self.order = other.order
38-
memcpy(self.data, other.data, self.size)
42+
memcpy(dest=self.data, src=other.data, count=self.size)
3943

4044
fn __moveinit__(out self, deinit existing: Self):
4145
self.height = existing.height
@@ -45,7 +49,7 @@ struct Matrix(Copyable, Movable, ImplicitlyCopyable, Sized):
4549
self.order = existing.order
4650
#existing.height = existing.width = existing.size = 0
4751
#existing.order = ''
48-
#existing.data = UnsafePointer[Float32]()
52+
#existing.data = UnsafePointer[Float32, MutAnyOrigin]()
4953

5054
# access an element
5155
@always_inline
@@ -56,7 +60,7 @@ struct Matrix(Copyable, Movable, ImplicitlyCopyable, Sized):
5660
else:
5761
loc = (column * self.height) + row
5862
if loc > self.size - 1 or loc < 0:
59-
raise Error("Error: Location is out of range!")
63+
raise Error("Location is out of range!")
6064
return self.data[loc]
6165

6266
@always_inline
@@ -72,6 +76,24 @@ struct Matrix(Copyable, Movable, ImplicitlyCopyable, Sized):
7276
fn __mul__(self, rhs: Self) raises -> Self:
7377
if self.width != rhs.height:
7478
raise Error('Error: Cannot multiply matrices with shapes (' + String(self.height) + ', ' + String(self.width) + ') and (' + String(rhs.height) + ', ' + String(rhs.width) + ')')
79+
80+
if self.height == 1 and rhs.width == 1:
81+
# Dot product
82+
var mat = Self(1, 1)
83+
mat.data[0] = self.ele_mul(rhs.T()).sum()
84+
return mat^
85+
86+
if self.height * self.width * rhs.width <= 4096:
87+
# matmul naive
88+
var mat = Self(self.height, rhs.width)
89+
for i in range(self.size):
90+
var rhsr = i % self.width
91+
for j in range(rhsr * rhs.width, rhsr * rhs.width + rhs.width):
92+
if rhsr != 0:
93+
mat.data[(Int(i / self.width) * mat.width) + (j % rhs.width)] += self.data[i] * rhs.data[j]
94+
else:
95+
mat.data[(Int(i / self.width) * mat.width) + (j % rhs.width)] = self.data[i] * rhs.data[j]
96+
return mat^
7597
var A = matmul.Matrix[DType.float32](self.data, (self.height, self.width))
7698
var B = matmul.Matrix[DType.float32](rhs.data, (rhs.height, rhs.width))
7799
var C = matmul.Matrix[DType.float32]((self.height, rhs.width))
@@ -91,7 +113,6 @@ struct Matrix(Copyable, Movable, ImplicitlyCopyable, Sized):
91113
return mat^
92114

93115
@staticmethod
94-
@always_inline
95116
fn random(height: Int, width: Int, order: String = 'c') -> Matrix:
96117
random.seed()
97118
var mat = Matrix(height, width, order= order)

0 commit comments

Comments
 (0)