00:00:00 --- log: started forth/21.05.06 00:19:51 is there a forth compiler to cuda? 00:20:05 corth 00:20:06 fuda? 00:59:34 omg i was asking the same question earlier :) 00:59:43 looking for one 00:59:50 there does not seem to be one 01:00:11 and im not sure how viable it is, not sure if you can do a cuda stack macine 01:01:12 not asked in here tho 01:07:34 mark4: i was asking because i was working with the haskell library accelerate and it seems like it would enable something like this 01:12:12 gpu forth. gorth? 01:15:40 gforth }:) 01:15:43 ugh 01:34:59 mark4: you should check out accelerate 01:41:44 i dont coder haskell :) 01:41:56 its almost 5am and ive not slept yt 02:14:27 Sleep is for the weak 02:20:18 --- quit: dave0 (Ping timeout: 245 seconds) 02:22:14 --- join: dave0 joined #forth 03:39:12 --- join: gravicappa joined #forth 03:51:35 --- join: f-a joined #forth 04:00:27 --- quit: dave0 (Quit: dave's not here) 04:10:27 mark4: maybe you should start. it's a great tool for building compilers and interpreters. 04:10:35 --- quit: proteusguy (Ping timeout: 252 seconds) 04:35:33 --- quit: andrei-n (Ping timeout: 240 seconds) 04:43:21 --- join: andrei-n joined #forth 04:55:52 --- quit: gravicappa (Ping timeout: 260 seconds) 05:37:48 --- join: gravicappa joined #forth 05:44:11 cheater: heh, haskellers lurking in the Forth channel! (am also a big fan of it for compilers and interpreters) 05:44:26 siraben: nice :) 05:44:46 i'm thinking of writing a simple language that can run on different processors at the same time 05:44:56 it comes from two backgrounds... 05:45:49 first of all, modern pcs have a cpu but also a very strong gp gpu. and even in a normal cpu, cores aren't exactly equal, due to things like locality etc. and then, now we're getting big/little combos, some cores are more powerful than others. 05:46:17 second of all, in vintage computers, you'd often have several different cpus, like a 6502 and a z80, or a 68000 and a z80, stuff like that 05:46:44 so i'm interested in figuring out how this could be intelligently managed by the programmer. 05:46:50 Ah, interesting. 05:46:59 you'd most likely want to be able to specify things explicitly, but then maybe you just don't care 05:47:07 I'd imagine something like, 4 Z80s in parallel would be quite powerful, relatively speaking. 05:47:54 Depending on the language of course, sounds like you could automatically parallelize certain blocks of code 05:51:37 i don't think they would be! 05:52:02 the sync would probably eat up all the time 05:52:15 i'm not exactly interested in uniform capabilities tbh 05:52:21 it's an explored space 05:52:25 Ah, right. 05:52:38 non-uniform is interesting to me in this regard 05:52:56 also because in reality you might end up realizing that a lot of things that are supposed to be uniform aren't 05:53:13 different power or temp throttling, different data locality, etc 05:53:26 Yeah, seems tricky. 05:53:34 i mean, is it? 05:53:59 all you really want is a language that can compile to two different targets 05:54:06 and then specify which target you want this to be in, inline 05:54:15 via a type 05:54:51 Oh, if you hand over control to the programmer, then it'd be much easier 05:54:57 I was thinking of automatic solutions 05:55:08 something like plus :: (Monad a, Target a) => a Int -> a Int -> a Int 05:55:27 looks like a tagless-final representation 05:55:37 and then you specify the a to either be TargetZ80 or Target6502 or Targetx64 or TargetCUDA or whatever 05:55:43 i never figured out what that is tbh 05:55:58 can you come up with a simple example that shows it's similar? 05:56:11 Sure, I used a very similar thing 05:56:22 https://siraben.github.io/2020/02/26/translating_cl.html 05:57:02 it's a bit contrived in that example, but the way you wrote `plus` means you could write sometihng like, `plus (lit 3) (lit 5)` 05:57:32 --- part: f-a left #forth 05:57:37 then when you specify the typeclasss at a call-site, it gets replaced with concrete constructors/function calls for that typeclass, e.g. it could generate Z80 or 6502 code or whatever 05:58:06 with that encoding you're also getting type checking for free, because you could encode `if_ :: m Bool → m a → m a → m a` 05:58:47 yeah that's what i mean 05:58:47 In my blog post, just by reinterpreting the assembly code in a different monad, I was able to pretty-print something that looked like C 05:59:09 does accelerate do final tagless too, in order to specify the backend? the same code you write can target the cpu or cuda. 05:59:26 What's accelerate? 05:59:35 the haskell library. look it up. 05:59:41 we were talking about it earlier here. 05:59:46 --- join: tech_exorcist joined #forth 06:00:09 whoa, that's great. 06:00:35 yeah it's pretty good 06:01:41 looking at the examples, it really looks like you get parallelism for free 06:01:49 i mean 06:01:58 bear in mind the data structures start out parallel 06:10:03 --- quit: cheater (Ping timeout: 240 seconds) 06:21:33 --- join: cheater joined #forth 06:43:29 --- quit: rpcope (Ping timeout: 252 seconds) 06:48:58 --- join: rpcope joined #forth 06:52:31 --- quit: cheater (Ping timeout: 260 seconds) 06:53:25 --- join: cheater joined #forth 07:04:04 --- quit: logand`` (Quit: ERC (IRC client for Emacs 27.1)) 07:07:05 --- join: actuallybatman joined #forth 07:15:45 --- join: Zarutian_HTC joined #forth 07:16:23 --- quit: cheater (Ping timeout: 260 seconds) 07:18:58 --- join: cheater joined #forth 07:25:49 siraben: sorry i got disconnected, maybe you said something as i was gone 07:40:16 --- join: proteusguy joined #forth 07:40:17 --- mode: ChanServ set +v proteusguy 08:10:08 has anyone implemented a forth core like excamera j1 or such using vector instructions? 08:11:03 lets say we have 16 bit cell and fit x cells into a vector register 08:11:41 this means we could have x many 'virtual' forth cores 08:12:30 cheater: Oh I didn't, last thing you said was the data structures start out parallel 08:20:10 yep 08:25:25 --- quit: tech_exorcist (Remote host closed the connection) 08:25:47 --- join: tech_exorcist joined #forth 08:26:35 --- join: f-a joined #forth 08:58:11 cheater: but then what? 08:58:15 is their use serial? 09:03:43 --- quit: gravicappa (Ping timeout: 260 seconds) 09:17:33 --- quit: f-a (Ping timeout: 240 seconds) 09:17:58 Hey guys - my daughter's in labor! First grandson on the way! 09:19:20 --- join: f-a joined #forth 09:22:57 KipIngram, the TI-84 daughter of the nspire one? 09:25:05 Congrats KipIngram 09:29:28 kidding obviously. congrats! 09:31:57 KipIngram: nice dude! well done. 09:32:04 siraben: idk man read the docs and see :) 09:32:23 not sure how to answer your question 09:35:43 :-) 09:48:24 cheater: Oh I thought something was going to be said after, so they just start out parallels? 09:48:27 parallel 09:48:36 yes 09:48:45 it's a matrix computation engine 09:48:47 like numpy 09:49:12 yeah 09:49:30 do you get things like fusion carried out? 09:51:14 yes 09:51:21 it's pretty good 10:21:12 Very elusive bug in my code. Actually having to roll up my sleeves... 10:29:16 AH HA! 10:29:22 Now it makes sense. 10:30:02 Whenn I compile a word, I'm not properly getting a flag onto the stack to tell the interpret loop to loop instead of executing. There's nothing there to execute, and I'm calling EXECUTE anyway. 10:44:53 Ok, just had left out a required DROP. 10:44:58 --- part: f-a left #forth 10:51:55 Annoyingly, that drop makes that the longest definition of the whole set. Grrr... 10:52:05 But I don't see a way to do it better. 11:19:37 --- quit: andrei-n (Quit: Leaving) 11:28:13 Well, shortened it a bit. A legitimate optimization, and then a bit of a "cheat"; I had a place where I was dropping a value known to be zero from the stack - I replaced the drop with a + to save three characters. ;-) 11:29:11 That feels a little mischievous to me, but oh well. 11:29:48 --- quit: Zarutian_HTC (Ping timeout: 240 seconds) 11:46:23 Of course this still isn't fully vetted. I don't know that the CFAs and literals are being compiled CORRECTLY into memory - i.e., being put in the right place the right way. I just have verified the data stack is behaving in all the right ways as I toggle STATE on and off. 11:46:48 Everything inside ] ... [ is being "appropriately ignored" as far as the stack goes. 11:47:04 I'll have to check later, when I have more tools, to see if that part's going right. 11:59:48 --- mode: ChanServ set +v mark4 12:04:50 so this is maybe a weird discussion topic, but i need somebody to rationalize the traditional forth : ; syntax for me 12:06:01 part of the problem with every custom forth i've tried creating is that i've become attached to the idea that compiled words should be syntactically similar to anything else, so i redefine : to mean "create a new word", then you follow that with some constructor (more on this in a minute), and then ; is basically just a reveal 12:06:22 e.g., instead of variable x you'd use : x variable ; 12:06:32 Yes, I think it's important that : words "behave like" primitives. 12:06:42 That uniform behavior is a "characteristic" of the language. 12:06:54 and instead of : foo bar baz ; you'd use : foo { bar baz } does ; 12:07:04 Well, you're having : play the role of your CREATE. 12:07:06 the problem with my style is that it's really noisy 12:07:10 yeah 12:07:39 I don't see anything particularly wrong with that approach. 12:08:02 i like that my style is syntactically consistent and involves combining more fundamental primitives, but i dislike the noise that comes with it 12:08:16 As you say, it's a bit noisy. But that noise is removing "conventions" that you have to remember, like : makes words that use (:), variable makes words that use (var), etc. 12:08:27 You're bringing those default actions out into the light. 12:09:12 CREATE is really the only defining word in traditional Forth. 12:09:28 The others use CREATE and then bundle some "changes" into the rest of their own definition. 12:09:56 yeah, true 12:10:13 Honestly Forth could have just offered CREATE and nothing else, and left it up to the programmer to decide if they wanted to wrapper those extra functions. 12:11:13 i would guess history is involved - that he came up with : before he factored out create 12:26:15 --- quit: Lord_Nightmare (Quit: ZNC - http://znc.in) 12:26:29 --- join: Lord_Nightmare joined #forth 12:35:25 Very likely. 12:35:43 And now : is just part of "Forth," fundamental or not. 12:38:16 In the very early days Forth (I don't know if it was even named, yet) didn't compile definitions. : name ...stuff... ; just stored ...stuff... in the dictionary, and if you used name it would just go replace it with the string. 12:38:23 And would nest that. 12:38:32 So it wouldn't have been very fast at all. 12:39:14 I'm not sure when the notion of compiled definitions got added. 12:42:02 --- join: dave0 joined #forth 12:42:26 maw 13:05:20 Afternoon dave. 13:05:23 dave0 13:08:11 hey KipIngram 13:13:51 --- quit: actuallybatman (Ping timeout: 246 seconds) 13:24:21 --- quit: joe9 (Quit: joe9) 13:31:16 --- join: Zarutian_HTC joined #forth 13:32:31 --- quit: Lord_Nightmare (Quit: ZNC - http://znc.in) 13:40:21 --- join: LispSporks joined #forth 13:40:31 --- join: Lord_Nightmare joined #forth 13:40:34 --- quit: LispSporks (Client Quit) 13:49:52 Ok, I got rid of that bit using + to "disappear" a zero from the stack. I replaced that bit of code with a bit using ?dup, which I find much more "professionally appealing." 13:50:27 I was using a value preserving conditional return. I need the value if I take the return, but if I don't it's zero and it's clutter. 13:50:40 So ?dup followed by a non-value preserving conditional return fixed things up. 13:51:05 Now there's nothing in it that I might scratch my head over a few years from now. 14:30:04 --- quit: tech_exorcist (Quit: tech_exorcist) 14:37:34 --- quit: Zarutian_HTC (Ping timeout: 240 seconds) 14:41:44 --- quit: wineroots (Remote host closed the connection) 14:47:57 --- join: Zarutian_HTC joined #forth 15:18:14 --- quit: proteus-guy (Ping timeout: 265 seconds) 15:27:29 Ah, I did figure ou a way to test some more things. I did this: 15:27:43 here ] + [ here swap - 64 + emit 15:28:23 and learned that compiling + advanced HERE by 4. And compiling a loop word, like 0=me, advanced it by eight, as it should. Four for the primitive and four for the offset. 15:29:43 KipIngram: i ran into an interesting bug this morning... i changed NEXT from post-increment to pre-increment, and all my variables broke (it took a while to track it down and i was surprised when i did) 15:30:34 --- join: proteus-guy joined #forth 15:30:41 I don't immediately see the connection - you mean you pre-increment the IP? 15:30:53 So that most of the time the IP points to the cell that's executing now? 15:30:57 KipIngram: ah yes yes pre-increment the IP 15:31:02 KipIngram: exactly 15:31:11 I have IP always pointing to the next cell to be executed - not the onen I'm doing now. 15:31:41 When you say "broke your variables" what do you mean exactly? 15:31:42 KipIngram: yes, i had always done that without ever thinking about why 15:32:16 I think the main thing I like about it is that it causes the IP to point at "parameter cells." 15:32:22 KipIngram: say it was the BASE variable.. my threaded code was header BASE cell DOCOL cell doVar cell 10 15:32:42 KipIngram: doVar did a r> to get a pointer to 10 15:32:49 So (lit) for instance scoops up the literal value from [IP] 15:33:08 KipIngram: but the IP pushed onto the return stack still pointed to the doVar cell *not* the 10 cell 15:33:10 Oh - right, you are direct threaded. 15:33:18 I forgot momentarily. 15:33:32 Yep yep - I got it now. 15:33:40 KipIngram: literal is no problem because it was a primitive and i already accounted for the different NEXT 15:34:01 but using r> to get a pointer to the parameter field broke! 15:34:05 Right. 15:34:11 Understand. 15:34:11 took me a while to find that bug :-p 15:34:23 See in my system the IP never points anywhere near the parameter field. 15:34:25 KipIngram: so i changed back to post-incrementing IP 15:34:29 I have the extra level of indirection. 15:34:34 KipIngram: aahh 15:34:53 It poinnts to a cell that POINTS to the parameter field in my system. 15:34:55 KipIngram: so NEXT has no effect on where the parameters are? 15:35:08 Right. 15:35:13 cool 15:35:45 I have my header - my link field, name field. Then immediately after the name field, aligned 4 bytes, is the CFA field followed by the PFA field. 15:35:58 pre-increment vs. post-increment has an effect on my threaded code ... i am gonna have to think about how to fix it 15:36:02 Each of those is four bytes. The CFA field points to code, and the PFA field points to... well, something else. 15:36:09 KipIngram: ooh 15:36:12 For : definitionns the PFA field points to the definition list. 15:36:20 KipIngram: i just inlined the parameters 15:36:51 Yes, in traditional Forth the parameter DATA immediately follows the CFA. 15:37:00 But not in mine. 15:37:04 What I get for that is this: 15:37:16 : foo ...codeA... 15:37:21 : bar ...codeB... ; 15:37:28 Notice no ; on the first one. 15:37:35 foo will just execute right on into bar. 15:37:45 ah interesting 15:37:46 There's nothing "in the way" related to the header of bar. 15:38:34 The definition lists go in the same region of RAM as primitive code. 15:38:52 I could intermingle primitive code and definition lists - it's just two different kinds of "implementation." 15:39:09 After that second pointer in the header is the next header, immediately. 15:39:45 does it let you do interesting tricks? 15:40:03 Well, the one I just described. 15:40:05 Mainly. 15:40:27 But another thing it would let me do is redefine a word, point the old header to the new list, and that would change it everywhere, even in existing definitions. 15:40:46 I can "vector" every word in the dictionary; in most Forth's a def you can do that to is special. 15:41:18 like redefining the 'ok' prompt! 15:41:24 Correct. 15:41:28 ehehe 15:41:36 a nice feature! 15:41:37 It's just a "built in native ability" in my architecture. 15:41:59 Of course, I'm wasting space. 15:42:11 I have that extra pointer that a traditional system wouldn't have, in every definition. 15:42:33 On the other hand, I don't have to include that extra pointer in primitive headers. 15:42:43 The CFA points to the code, and that's that - I don't even give them a PFA. 15:43:56 I have different macros, "code" and "def" for creating the two different header styles. 15:44:25 Here's an example that shows some of it in action: 15:44:31 ;;; : lfa 1- .c@ x:80 and 0=me 2- ; 15:44:33 def "lfa", lfa 15:44:35 run onem, dcload, plit, 0x80+do, and, zeme, 28+do, twom, dosem 15:44:37 yY 15:44:54 "def" makes the header with a PFA pointer, and it puts the stuff on "run" at that pointer location. 15:45:13 So even though those two lines are together in the source, they manipulate parts of completely different RAM sections. 15:46:01 That "run" macro takes a variable argument count. 15:51:47 --- join: cheater1 joined #forth 15:54:08 --- quit: cheater (Ping timeout: 240 seconds) 17:57:30 --- join: joe9 joined #forth 18:14:23 The run macro actually assembles the offset of the indicated label from the beginning of the definition region. That's why the literal values have +do on them - the address of do gets subtracted from everything when it's assembled. So I have to "pre-add" do to litera values and jump offsets. 18:14:48 But that's better than having to subtract somethinng manually from every label, which is the way my last one worked. These macros are much nicer. 18:27:20 --- quit: lonjil (Ping timeout: 276 seconds) 18:29:07 --- join: lonjil joined #forth 18:46:57 --- join: LispSporks joined #forth 18:47:23 --- join: boru` joined #forth 18:47:26 --- quit: boru (Disconnected by services) 18:47:28 --- nick: boru` -> boru 18:53:33 --- quit: proteus-guy (Ping timeout: 240 seconds) 19:05:41 --- quit: lonjil (Ping timeout: 276 seconds) 19:05:50 --- join: proteus-guy joined #forth 19:09:02 --- join: lonjil joined #forth 19:24:42 I guess I should do CREATE now. 19:25:51 That should actually be pretty easy. bl word, fill in link, cfa, pfa, bump dp forward. 19:26:07 Oh, and update vocabulary pointer. 19:28:36 --- quit: proteus-guy (Ping timeout: 265 seconds) 19:31:09 --- quit: sts-q (Ping timeout: 246 seconds) 19:33:08 --- join: sts-q joined #forth 19:34:59 --- quit: LispSporks (Quit: My MacBook has gone to sleep. ZZZzzz…) 19:40:45 --- join: proteus-guy joined #forth 19:52:44 --- quit: Zarutian_HTC (Ping timeout: 252 seconds) 20:08:11 --- join: LispSporks joined #forth 20:19:44 --- join: gravicappa joined #forth 20:51:06 --- quit: LispSporks (Quit: My MacBook has gone to sleep. ZZZzzz…) 21:08:13 Got a draft of create now. There are quite a few moving parts in that one, but it "chunked out" into reasonable factors fairly well. 22:38:27 --- quit: gravicappa (Ping timeout: 260 seconds) 23:20:24 --- join: Zarutian_HTC joined #forth 23:59:59 --- log: ended forth/21.05.06