Darkmatter
Darkmatter
MModular
Created by Darkmatter on 9/17/2024 in #questions
MAX for fixed-function hardware
Does MAX have the ability to represent fixed-function hardware or hardware which has limited programmability? For instance, cryptographic accelerators (Intel QAT, AMD CCP) or NPUs (Intel, AMD, Qualcom, Apple). For "limited programmability", I mean devices like P4 NICs, which are not quite as flexible as FPGAs but are still flexible enough a programming language was required to use them (P4). The language is not turing complete by design to allow for fixed-function ASICs to implement it easily.
5 replies
MModular
Created by Darkmatter on 9/17/2024 in #questions
Mojo equivalent to Rust's phantom type
Does Mojo have an equivalent to Rust's phantom type? I have a few usecases where I need a raw pointer (for syscalls) to be assigned a lifetime via a wrapper, such as for iovec.
2 replies
MModular
Created by Darkmatter on 8/14/2024 in #questions
Reliability of Niche Optimizations
Is this behavior that I can rely on? I'm going to write some code that will blow up spectacularly on ARM if this is ever not true.
sizeof[Optional[fn(...) -> ...]]() == sizeof[UnsafePointer[_]]()
sizeof[Optional[fn(...) -> ...]]() == sizeof[UnsafePointer[_]]()
2 replies
MModular
Created by Darkmatter on 7/20/2024 in #questions
Is there any documentation for Mojo MLIR dialect(s)?
I have embarked on a perhaps foolish quest make calling into C easier by using mlir-translate to import LLVM IR (since clang isn't MLIR ready yet). This does involve a bit of -fdebug-macro as well, and converting those into constants for Mojo. While I can infer some things from error messages, proper documentation would make this much easier. The intention is to make liberal use of inline MLIR for function bodies, and then do my best to translate structs, function signatures, and constants.
3 replies
MModular
Created by Darkmatter on 7/3/2024 in #questions
Does Mojo have inline assembly?
Does Mojo currently have a blessed way to do inline assembly? LLVM doesn't have intrinsics for ARM MSR reads, and the two best clocks on an ARM system from a microbenchmark perspective are cntvct_el0 and pmccntr_el0, both of which are MSRs. In C I would normally read them as follows:
uint64_t tsc;

__asm__ volatile("isb" ::: "memory");
__asm__ volatile("mrs %0, cntvct_el0" : "=r" (tsc));
uint64_t tsc;

__asm__ volatile("isb" ::: "memory");
__asm__ volatile("mrs %0, cntvct_el0" : "=r" (tsc));
uint64_t tsc;
__asm__ volatile("isb" ::: "memory");
__asm__ volatile("mrs %0, pmccntr_el0" : "=r"(tsc));
uint64_t tsc;
__asm__ volatile("isb" ::: "memory");
__asm__ volatile("mrs %0, pmccntr_el0" : "=r"(tsc));
1 replies
MModular
Created by Darkmatter on 6/25/2024 in #questions
Any Plans for SPIR-V/OpenCL Support?
Are there any plans for a SPIR-V target for Mojo or an OpenCL backend for Max? It would be useful since it would allow leveraging OpenCL compatible hardware instead of whatever Modular can specifically add support for, in particular FPGAs are very good at inference on small models on price/perf when looking at major cloud providers.
2 replies
MModular
Created by Darkmatter on 5/19/2024 in #questions
JSON Parser?
Does Mojo have a JSON parser library somewhere in the ecosystem? I'm getting name collisions with C and Perl libraries so I can't find anything. Python interop isn't quite at the level where I can use the Python stdlib one. This is reading some config data, so performance is a not a concern.
2 replies