|
2 | 2 |
|
3 | 3 | from algorithm import vectorize, parallelize |
4 | 4 | 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 |
7 | 6 | import benchmark |
8 | 7 | from testing import assert_equal |
9 | 8 | from utils import IndexList |
@@ -33,9 +32,8 @@ fn intsqrt[n: Int]() -> Int: |
33 | 32 | return x |
34 | 33 |
|
35 | 34 |
|
36 | | -@value |
37 | 35 | @register_passable("trivial") |
38 | | -struct Layout(Writable): |
| 36 | +struct Layout(Copyable, Movable, Writable): |
39 | 37 | var shape: IndexList[2] |
40 | 38 | var strides: IndexList[2] |
41 | 39 |
|
@@ -70,7 +68,7 @@ struct Matrix[Type: DType]: |
70 | 68 |
|
71 | 69 | @always_inline("nodebug") |
72 | 70 | fn __init__( |
73 | | - out self, data: UnsafePointer[Scalar[Type]], owned layout: Layout |
| 71 | + out self, data: UnsafePointer[Scalar[Type]], var layout: Layout |
74 | 72 | ): |
75 | 73 | self.data = UnsafePointer[Scalar[Type]](data) |
76 | 74 | self.layout = layout |
@@ -445,7 +443,7 @@ fn matmul_params[Type: DType]() -> IndexList[5]: |
445 | 443 | alias mc = 8192 // sizeof[Type]() # fix this for simplicity |
446 | 444 | alias N = simdwidthof[Type]() |
447 | 445 |
|
448 | | - alias Vectors = 32 if has_avx512f() else 16 |
| 446 | + alias Vectors = 32 if CompilationTarget.has_avx512f() else 16 |
449 | 447 |
|
450 | 448 | @parameter |
451 | 449 | fn compute_kc[mr: Int, nr: Int]() -> Int: |
@@ -474,7 +472,7 @@ fn matmul_params[Type: DType]() -> IndexList[5]: |
474 | 472 | if Type is DType.int64: |
475 | 473 |
|
476 | 474 | @parameter |
477 | | - if has_avx512f(): |
| 475 | + if CompilationTarget.has_avx512f(): |
478 | 476 | alias TempVectors = 2 |
479 | 477 | return compute_params[Vectors - TempVectors]() |
480 | 478 | else: |
|
0 commit comments