brainiacoutcast
brainiacoutcast
MModular
Created by benny on 2/17/2024 in #questions
SHA256
was that the later two or the very first one at the top of the channel? first ones broke
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
let test_string = "mojo"
let raw_ptr = test_string.data()
let p = raw_ptr.bitcast[DType.uint8]()._as_scalar_pointer()
let buffer = Buffer[Dim(), DType.uint8](p, test_string.__len__())
let hash = sha256(buffer)
let test_string = "mojo"
let raw_ptr = test_string.data()
let p = raw_ptr.bitcast[DType.uint8]()._as_scalar_pointer()
let buffer = Buffer[Dim(), DType.uint8](p, test_string.__len__())
let hash = sha256(buffer)
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
you can just use it unattributed
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
Buffer[_, DType.uint8, 0]
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
i got no idea how to cast the pointers right for that in mojo
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
@Michael K I added in the unroll and changed the function's address space to the generic 0, then i just got in there and went all the way, got rid of the copying in-memory for most of the data, except the last ~64 bytes. On my laptop this takes it from 250 to 350, so you will probably hit 500. Now it's essentially taking the same approach I did in rust, and the performance is within 1%! The next step would be to work in some highly-non-portable assembly (or punt to openssl, lol)
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
that's nuts, what cpu and clock speed are you running with? re: copying ideally i'd like to have no dynamicvector inside the sha function at all, just wanted to read the buffer as-is for most of it and then use an InlinedFixedVector to manage the tail, but it's nice to see that it went a little faster from calling a builtin
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
granular loop unrolling is very nice to have
35 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
worked out all the bugs as far as i can tell, added a crude benchmark to main - performs pretty well for having to copy everything
35 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
we're both gonna make it
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
make sure you use the latest from https://docs.modular.com/mojo/ - third party sites may be weeks or more out of date
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
if you go through it slowly top to bottom, you'll see unable to locate module 'Vector' - in the docs it's lowercase
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
DynamicVector may not even need to be imported, might just be in prelude is just in the prelude already, no need to import
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
in this specific case though, i believe vector is just lowercase, collections.vector
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
you can try mojo filename.mojo to attempt running it and get a slightly more specific message (and stack dump)
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
personally, delete things until it's back at a state where the ide help works again, i'm only a couple days into trying it myself
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
while it may take some fiddling to get the dynamicvector working, you're on the right path to getting the program working if you need to index into a collection with a value from a variable
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
it's fairly common to have the parser crashing, remember that this language is pre 1.0, you are helping with early testing
30 replies
MModular
Created by Aamir on 2/18/2024 in #questions
Seeking Guidance and Best Practices for Lists and Tuples in Mojo Language
you're probably used to using square brackets on python's lists, for mojo's ListLiteral you'll need to use the .get method https://docs.modular.com/mojo/stdlib/builtin/builtin_list.html#get or alternatively, you might be able to just use a dynamicvector if your items in the list are all the same type
30 replies
MModular
Created by benny on 2/17/2024 in #questions
SHA256
emphasis on rigorously untested, can't wait to see what you all come up with though
35 replies