Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mojoproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
"sandstromviktor <>",
"durnwalder <>"
]
channels = ["https://conda.modular.com/max-nightly", "https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"]
channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"]
platforms = ["osx-arm64", "linux-64"]
license = "Apache-2.0"
readme = "README.MD"
Expand Down Expand Up @@ -46,8 +46,8 @@ doc_pages = "mojo doc numojo/ -o docs.json"
release = "clear && magic run final && magic run doc_pages"

[dependencies]
max = "==24.6.0"
python = ">=3.9,<3.13"
numpy = ">=1.19,<2.2"
scipy = ">=1.14,<1.15"
mdutils = ">=1.6.0"
max = "=25.1"
python = ">=3.11"
numpy = ">=1.19"
scipy = ">=1.14"
mdutils = ">=1.6"
116 changes: 58 additions & 58 deletions numojo/core/complex/complex_dtype.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct CDType(
__mlir_attr.`#kgen.dtype.constant<ui64> : !kgen.dtype`,
)
"""Represents an unsigned integer type whose bitwidth is 64."""
alias float8e5m2 = CDType(
alias float8_e5m2 = CDType(
__mlir_attr.`#kgen.dtype.constant<f8e5m2> : !kgen.dtype`,
__mlir_attr.`#kgen.dtype.constant<f8e5m2> : !kgen.dtype`,
)
Expand All @@ -98,7 +98,7 @@ struct CDType(
- -inf: 11111100
- -0: 10000000
"""
alias float8e5m2fnuz = CDType(
alias float8_e5m2fnuz = CDType(
__mlir_attr.`#kgen.dtype.constant<f8e5m2fnuz> : !kgen.dtype`,
__mlir_attr.`#kgen.dtype.constant<f8e5m2fnuz> : !kgen.dtype`,
)
Expand All @@ -113,7 +113,7 @@ struct CDType(
- fn: finite (no inf or -inf encodings)
- uz: unsigned zero (no -0 encoding)
"""
alias float8e4m3 = CDType(
alias float8_e4m3 = CDType(
__mlir_attr.`#kgen.dtype.constant<f8e4m3> : !kgen.dtype`,
__mlir_attr.`#kgen.dtype.constant<f8e4m3> : !kgen.dtype`,
)
Expand All @@ -132,7 +132,7 @@ struct CDType(
- -0: 10000000
- fn: finite (no inf or -inf encodings)
"""
alias float8e4m3fnuz = CDType(
alias float8_e4m3fnuz = CDType(
__mlir_attr.`#kgen.dtype.constant<f8e4m3fnuz> : !kgen.dtype`,
__mlir_attr.`#kgen.dtype.constant<f8e4m3fnuz> : !kgen.dtype`,
)
Expand Down Expand Up @@ -232,14 +232,14 @@ struct CDType(
return CDType.uint64
if dtype == DType.index:
return CDType.index
if dtype == DType.float8e5m2:
return CDType.float8e5m2
if dtype == DType.float8e5m2fnuz:
return CDType.float8e5m2fnuz
if dtype == DType.float8e4m3:
return CDType.float8e4m3
if dtype == DType.float8e4m3fnuz:
return CDType.float8e4m3fnuz
if dtype == DType.float8_e5m2:
return CDType.float8_e5m2
if dtype == DType.float8_e5m2fnuz:
return CDType.float8_e5m2fnuz
if dtype == DType.float8_e4m3:
return CDType.float8_e4m3
if dtype == DType.float8_e4m3fnuz:
return CDType.float8_e4m3fnuz
if dtype == DType.bfloat16:
return CDType.bfloat16
if dtype == DType.float16:
Expand Down Expand Up @@ -283,14 +283,14 @@ struct CDType(
return CDType.uint64
if dtype == DType.index:
return CDType.index
if dtype == DType.float8e5m2:
return CDType.float8e5m2
if dtype == DType.float8e5m2fnuz:
return CDType.float8e5m2fnuz
if dtype == DType.float8e4m3:
return CDType.float8e4m3
if dtype == DType.float8e4m3fnuz:
return CDType.float8e4m3fnuz
if dtype == DType.float8_e5m2:
return CDType.float8_e5m2
if dtype == DType.float8_e5m2fnuz:
return CDType.float8_e5m2fnuz
if dtype == DType.float8_e4m3:
return CDType.float8_e4m3
if dtype == DType.float8_e4m3fnuz:
return CDType.float8_e4m3fnuz
if dtype == DType.bfloat16:
return CDType.bfloat16
if dtype == DType.float16:
Expand Down Expand Up @@ -335,14 +335,14 @@ struct CDType(
return CDType.uint64
elif str == String("index"):
return CDType.index
elif str == String("float8e5m2"):
return CDType.float8e5m2
elif str == String("float8e5m2fnuz"):
return CDType.float8e5m2fnuz
elif str == String("float8e4m3"):
return CDType.float8e4m3
elif str == String("float8e4m3fnuz"):
return CDType.float8e4m3fnuz
elif str == String("float8_e5m2"):
return CDType.float8_e5m2
elif str == String("float8_e5m2fnuz"):
return CDType.float8_e5m2fnuz
elif str == String("float8_e4m3"):
return CDType.float8_e4m3
elif str == String("float8_e4m3fnuz"):
return CDType.float8_e4m3fnuz
elif str == String("bfloat16"):
return CDType.bfloat16
elif str == String("float16"):
Expand Down Expand Up @@ -388,14 +388,14 @@ struct CDType(
return DType.uint64
if other == CDType.index:
return DType.index
if other == CDType.float8e5m2:
return DType.float8e5m2
if other == CDType.float8e5m2fnuz:
return DType.float8e5m2fnuz
if other == CDType.float8e4m3:
return DType.float8e4m3
if other == CDType.float8e4m3fnuz:
return DType.float8e4m3fnuz
if other == CDType.float8_e5m2:
return DType.float8_e5m2
if other == CDType.float8_e5m2fnuz:
return DType.float8_e5m2fnuz
if other == CDType.float8_e4m3:
return DType.float8_e4m3
if other == CDType.float8_e4m3fnuz:
return DType.float8_e4m3fnuz
if other == CDType.bfloat16:
return DType.bfloat16
if other == CDType.float16:
Expand Down Expand Up @@ -453,14 +453,14 @@ struct CDType(
return writer.write("cuint64")
if self == CDType.index:
return writer.write("cindex")
if self == CDType.float8e5m2:
return writer.write("cfloat8e5m2")
if self == CDType.float8e5m2fnuz:
return writer.write("cfloat8e5m2fnuz")
if self == CDType.float8e4m3:
return writer.write("cfloat8e4m3")
if self == CDType.float8e4m3fnuz:
return writer.write("cfloat8e4m3fnuz")
if self == CDType.float8_e5m2:
return writer.write("cfloat8_e5m2")
if self == CDType.float8_e5m2fnuz:
return writer.write("cfloat8_e5m2fnuz")
if self == CDType.float8_e4m3:
return writer.write("cfloat8_e4m3")
if self == CDType.float8_e4m3fnuz:
return writer.write("cfloat8_e4m3fnuz")
if self == CDType.bfloat16:
return writer.write("cbfloat16")
if self == CDType.float16:
Expand Down Expand Up @@ -662,17 +662,17 @@ struct CDType(
@always_inline("nodebug")
fn is_float8(self) -> Bool:
"""Returns True if the type is a 8bit-precision floating point type,
e.g. float8e5m2, float8e5m2fnuz, float8e4m3 and float8e4m3fnuz.
e.g. float8_e5m2, float8_e5m2fnuz, float8_e4m3 and float8_e4m3fnuz.

Returns:
True if the type is a 8bit-precision float, false otherwise.
"""

return self in (
CDType.float8e5m2,
CDType.float8e4m3,
CDType.float8e5m2fnuz,
CDType.float8e4m3fnuz,
CDType.float8_e5m2,
CDType.float8_e4m3,
CDType.float8_e5m2fnuz,
CDType.float8_e4m3fnuz,
)

@always_inline("nodebug")
Expand Down Expand Up @@ -706,7 +706,7 @@ struct CDType(
"""

if self._is_non_index_integral():
return int(
return Int(
UInt8(
__mlir_op.`pop.shl`(
UInt8(1).value,
Expand All @@ -727,14 +727,14 @@ struct CDType(
return 2 * sizeof[DType.bool]()
if self == CDType.index:
return 2 * sizeof[DType.index]()
if self == CDType.float8e5m2:
return 2 * sizeof[DType.float8e5m2]()
if self == CDType.float8e5m2fnuz:
return 2 * sizeof[DType.float8e5m2fnuz]()
if self == CDType.float8e4m3:
return 2 * sizeof[DType.float8e4m3]()
if self == CDType.float8e4m3fnuz:
return 2 * sizeof[DType.float8e4m3fnuz]()
if self == CDType.float8_e5m2:
return 2 * sizeof[DType.float8_e5m2]()
if self == CDType.float8_e5m2fnuz:
return 2 * sizeof[DType.float8_e5m2fnuz]()
if self == CDType.float8_e4m3:
return 2 * sizeof[DType.float8_e4m3]()
if self == CDType.float8_e4m3fnuz:
return 2 * sizeof[DType.float8_e4m3fnuz]()
if self == CDType.bfloat16:
return 2 * sizeof[DType.bfloat16]()
if self == CDType.float16:
Expand Down
Loading