#šŸ’½Programming Chat v2

1 messages Ā· Page 41 of 1

spare quartz
#

blah blah blah you're just mad you can't use ipc as beautifully as i do

#

the os idea i did have one time and is written in a document somewhere details a more extreme microkernel

#

basically just permission rings but if we added more

#

give THIS specific process the ability to use io ports, but not that one

timid quartz
#

macrokernel on top you’re just mad you’re not fast and you still haven’t really solved any problems with fault tolerance

spare quartz
#

"fault tolerance" and his system crashes when a vendor makes one oopsie 😭😭

#

crowdstrike looking ahh 😭

timid quartz
#

your userspace is still left degraded or unusable

spare quartz
#

nope

timid quartz
#

might as well have just crashed

spare quartz
#

not only is your statement HIGHLY dependent on whats crashed its not really true

#

if a peripheral driver dies thats fine

#

if a display driver dies thats fine

#

for you? both would crash

#

we can just restart it

timid quartz
#

how you gonna restart it if your peripheral dies lol

#

can’t type ā€œrestartā€ with no keyboard!!

spare quartz
#

... thats

#

why other processes can see that they've crashed 😭

timid quartz
#

what if your process manager dies :3

spare quartz
#

why would it die

timid quartz
#

cause it could

spare quartz
#

okay

#

we restart it

timid quartz
#

how

spare quartz
#

by sending a message

timid quartz
#

You can’t schedule a process if there’s no process scheduler

spare quartz
#

you can

#

and if you're ever at a point where IPC dies, which is usually one of the only things IN a microkernel

#

then you're just what-a-bouting and obviously theres no recovery

timid quartz
#

I’m just hearing microkernel inferiority tbh

spare quartz
#

yeah ok

#

tell me when you got your stupid little monolithic kernel not dying from a sneeze

timid quartz
#

oh it doesn’t dw

spare quartz
#

šŸ‘ƒ

timid quartz
#

It’s actually quite speedy

spare quartz
#

this mf would put his scrollbar code in his kernel to make things faster 😭

timid quartz
#

You also don’t get pretty visuals like this

timid quartz
#

enough said

spare quartz
#

🪦

timid quartz
spare quartz
#

hmmm

#

I should write my own Intel firmware update

#

😁

timid quartz
#

lmao have fun bricking your cpu

#

new vuln: furdown

spare quartz
#

remember… everything’s an external dependency..

timid quartz
#

Your entire kernel is an external dependency

spare quartz
#

no

timid quartz
#

Whereas mine is all bundled together in a nice little package

spare quartz
#

(full of external dependencies)

timid quartz
#

nah

#

Meanwhile if your kernel has no external dependencies it wouldn’t do anything except IPC

#

but there’d also be no processes

spare quartz
#

nah

#

we just do a little outsourcing

#

the KERNEL doesn’t depend on anything

timid quartz
spare quartz
#

no.

lavish dove
lavish dove
#

they are so fucking good

radiant slate
#

Die

spare quartz
#

inventing new ways for QEMU to fail but pass on the simulator

spare quartz
#

good news

#

our bootloader's size limit went frrom 512 bytes

#

to

#

523.00800 kilobytes

timid quartz
#

What are you gonna do with all those bytes

spare quartz
#

whatever we want

#

don't need to load a second stage anymore

timid quartz
#

ngl…I see why eating tide pods became a trend briefly…they feel kinda scrumptious

spare quartz
#

rust dev activities

#

we briefly had the kernel overwrite the bootloader

timid quartz
#

I mean once the bootloader is done…

#

doesn’t rlly matter

spare quartz
#

well yeah but this was during section loading šŸ’€

#

having the loader set to 00s before it can load everything fully and jump is not optimal

timid quartz
#

o h

spare quartz
#

ultimately i also had to make QEMU load in 1 section at a time

#

or else i'd get a DMA error

timid quartz
#

L

spare quartz
#

not l

#

just annoying

timid quartz
#

but now are you able to not do that?

spare quartz
#

wdym

timid quartz
#

like

#

can you load multiple sections with no error

spare quartz
#

yeah

spare quartz
#
iso_9660_directory_read:
    mov di, 0x7E01
    mov cx, 0xFFFF
    repne scasw
    sub di, 2
    push dx
    mov ax, [di-23]
    mov dx, [di-21]
    mov cx, 2048
    div cx
    cmp dx, 0
    pop dx
    jz .iso_9660_directory_configure_load
    inc ax
.iso_9660_directory_configure_load:
    mov cx, ax
    mov DWORD [si+4], 0x00008600
    push DWORD [si+4]
    mov ebx, DWORD [edi-31]
    mov DWORD [si+8], ebx
.iso_9660_directory_load_chunked:
    call int13_extended_read_procedure
    add WORD [si+6], 0x80
    add DWORD [si+8], 1
    loop .iso_9660_directory_load_chunked
    pop DWORD [si+4]
    ret
pvd_disk_address_packet:
    db 0x10               ; Size
    db 0x00               ; Reserved
    dw 0x0001             ; Sector Count
    dw 0x0000             ; Transfer Offset
    dw 0x07E0             ; Transfer Segment
    dq 0x0000000000000010 ; Disk Block Number
#

scans for the file name (e.g. "KERN"), uses an offset from the name to get position in file/size

#

divides size by 2048 to get block count, sets the DAP to use the block position

#

and then loop adding 0x80 to the segment position of the DAP until block count is zero

#

additionally at the end it sets the DAP transfer position to the starting value with the pop there

#

probably not the best code but i tried being frugal

spare quartz
#

LOL

#

WRONG IMGE!!!

#

@timid quartz

timid quartz
#

what

spare quartz
#

fixed

#

do NOT look at logs

timid quartz
#

im looking in audit logs

spare quartz
#

NO

timid quartz
#

interesting.

spare quartz
#

pls tell me you dont actually log images 😭😭

timid quartz
#

:3

spare quartz
#

the video that thumbnail is from would get me banned 900 times over

#

😭

timid quartz
#

I can't find it on yt

spare quartz
#

lemme get the link

#

its a video where bayachao actually speaks in english (albeit not the greatest)

spare quartz
#

actually

#

it is definitely like that

#

carry on

rustic vine
#

you're lucky nobody is locked in on moderating this place

spare quartz
#

cause we all moderate ourselves :3

#

simply a fault of windows clipboard for sending it

rustic vine
#

everyone except for you apparently

spare quartz
#

a fault of windows clipboard

proud creek
#

Did I hear moderate

spare quartz
#

you heard coding

proud creek
spare quartz
#

idk tz wearing a fursuit all day isnt good for acoustics

proud creek
rustic vine
#

I made a code joke in a non code channel and it went silent lol

spare quartz
rustic vine
#

this morning

spare quartz
#

ā˜£ļø

rustic vine
#

whens the last time YOU showered

spare quartz
#

no comment

rustic vine
#

brah

spare quartz
#

im kiddinggggg

#

like 12 hrs ago

rustic vine
#

I've always showered every day and people tell me its bad

#

but idk my hair is fine so I've ignored them thus far

spare quartz
#

i think the only bad thing there is if you're constantly rinsing it in long showers

#

but different people have different hair

rustic vine
#

ye

spare quartz
#

uuugggggghhhhhhhh

#

running xorriso and nasm is so tedious

#

gonna try and make a simple assembler thing soon..

spare quartz
#

neat

lavish dove
#

got fuckin annoyed by xorriso

spare quartz
#

ive still got no experience in how compilers work

#

kys emoji user

spare quartz
timid quartz
#

So just uh

#

Instead of executing the code

#

Interpret it to binary

rustic vine
#

invert the plant

spare quartz
#

oh

#

wow

#

you both

#

asy stuff

spare quartz
#

you can't do that with assembly

timid quartz
#

an interpreter executes the code

#

but as a part of that it has to parse each line

#

so replace the "code execution" part of an interpreter with a part that translates the assembly into binary

rustic vine
timid quartz
#

yeah

#

that's what I was trying to say

spare quartz
#

im not saying i dont know the concept/how to build one

timid quartz
#

you already know how to make an interpreter

#

so just...

#

change a little bit

spare quartz
#

im saying i haven't done this before 😭

#

excluding sql

timid quartz
#

now if you want to do optimizations and jazz

rustic vine
#

🄺

spare quartz
#

i know multiple passes

timid quartz
#

that's an entirely different thing that leans into CS theory

#

but it's still neat

rustic vine
spare quartz
#

i know a bit how optimizations are implemented within compilers

timid quartz
#

color a graph in polynomal time ca

spare quartz
#

in asm multipass optimization is very simple

timid quartz
#

right but what kind of optimizations are you doing multiple passes for :3

spare quartz
#

but the subject being replaced has 30 years of updates im up against

timid quartz
#

tbh honestly

#

do some uh

timid quartz
#

right but what kinds of optimizations do those entail :3

spare quartz
#

anyways since im busy playing wolfenstein i havent been able to work on it much

timid quartz
#

what kinds of things are you doing in your multiple passes :3

spare quartz
#

literally read the thing

rustic vine
timid quartz
#

mm it's definitely doing more than it's specifying

rustic vine
timid quartz
#

gotta do your constant propogation, redundancy elimination, reaching definitions, dead code elimination

spare quartz
#

the NASM testfiles for opts can be found here

timid quartz
#

data flow analysis

spare quartz
#

extrapolate and search the files as you see fit

spare quartz
#

and most of that is irrelevant in ASM

timid quartz
#

this is what is done in the multiple passes

spare quartz
#

you cannot do "dead code elimination" for example

#

constants aren't a thing either

#

they're just a S&R

timid quartz
rustic vine
#

im gonna wait for the smart people to finish talking so I can ask my dumb question 😃

spare quartz
#

what is your dumb question

#

we can multitask

timid quartz
#

although this kinda falls under redundancy elimination, you can do stuff like detecting that you compute a+b once and don't ever re-define a or b and then replace every re-calculation of a+b with either the evaluated constant or a reference if you cant evaluate it at comptime

timid quartz
#

...yeah you can

spare quartz
#

ADD, SUB, etc. all affect CPU flags

#

in ASM this is significant

rustic vine
#

im trying to understand how the butcher tableau of RK integration methods were calculated/came-about

#

idk how it works cause wikipedia just gives them to you as magic numbers and doesn't elaborate

#

and so does every other paper

timid quartz
#

if your assembly is being outputted by gcc then yeah gcc already does most of this

rustic vine
#

its not a big deal though. I don't need to know, I was just curious

timid quartz
#

but if your assembly is being written directly by humans then there's places to optimize

spare quartz
#

GCC is not an assembler

timid quartz
#

gcc can output assembly stupid

#

gcc -s

spare quartz
#

it's not an assembler though

rustic vine
#

this code sucks session terminated

spare quartz
rustic vine
#

no bruh I swear its simple

#

the RK4 one looks really simple

#

but the dormand-price one is like 20 random numbers

#

this

#

I think bro just willed this into existence one day

spare quartz
#

where are the values used

timid quartz
#

ew numbers

rustic vine
#

its the coeffs for it

timid quartz
#

you had mentioned that you didn't have experience with implementing a compiler and then linked an assembler

spare quartz
#

probably not whats going on here

spare quartz
#

an assemblers job is to turn assembly language into machine code, a compilers job is to do the same, but at a more generic level: it could convert C to IR for example

rustic vine
#

yeah I think I'm just meant to take these coeffs at face value and not try to think about why they are what they are

#

thats fine

#

I was just wondering if anyone had any insight

spare quartz
#

IR doesn't have the same "significances" as ASM like flag or data placement, the compiler can put whatever

timid quartz
#

I am well aware

spare quartz
#

therefore, optimizations exist, but they're different or not relevant to assembly

timid quartz
#

the general flow of a high level compiler is to take your high level language, make it IR and optimize the IR, and then take the IR and output machine assembly for it

#

im taking a class on this fgs

spare quartz
timid quartz
#

I mean ig not

#

the fact that you can't optimize assembly in a similar way to IR doesn't entirely make sense

#

because I can write two different .s files that do the same thing but one is more "optimal"

spare quartz
#

that's too generic though

timid quartz
#

without caring about CPU state or flags too much

spare quartz
#

you can make a superior version of something, thats the end result, but we're talking about the destination to the result

spare quartz
#

(it's always about assumptions...)

timid quartz
#

im assuming that i can send a missile to your house

spare quartz
#

nuh uh

#

hey wait

timid quartz
#

too bad

spare quartz
#

no nvm

#

i was gonna ask if you had a kernel written in rust i could maybe see

timid quartz
#

no I don't

spare quartz
#

but even if you did have one it'd probably be too complex for a test sample :<

timid quartz
#

it'd probably be too fat

spare quartz
#

i should really write unit tests for our processor

#

viewing disassembler output and stepping in qemu at the same time makes my brain itch

spare quartz
#

since it's literally it's own micro-kernel

#

it does so many instructions that it just causes my output to die

#

NOT QEMU

#

god ... GRUB

#

always get the two mixed

timid quartz
#

well at least with rust

#

you could be delivered from gdb

#

and go to a similar hell called lldb

spare quartz
#

what's lldb

#

llvms knockoff of gdb?

timid quartz
#

gdb for llvm programs

#

yeah

timid quartz
#

you're not using kotlin/native are you

#

for your kernel

spare quartz
#

.. why would i??

#

and do you know how many hoops i'd have to go thru

#

ufedmi_k is written in ada

timid quartz
spare quartz
#

um

#

a cpu in minecraft is very conventional

#

and two

#

not challenging. just tedious.

#

everything in programming is easy its just tedious

timid quartz
#

ok then uh

#

Write an algorithm that colors a graph in polynomial time

spare quartz
#

i dont know what polynomial time means or what a polynomial is

#

also what does color mean in this context

#

or graph

timid quartz
#

This guy doesn’t know graph theory or big O

spare quartz
#

YEAH CAUSE I DONT DO MATH

timid quartz
#

It’s not really math

#

Ok so basically

spare quartz
#

its all math

#

once you're theorizing instead of coding, that's math

timid quartz
#

A graph is a collection of nodes linked together by edges

spare quartz
#

what is an edge

timid quartz
#

Like this is a graph for example

spare quartz
#

is an edge another name for reference

timid quartz
#

I mean you could think of it that way but this has little to do with code right now

spare quartz
#

aera i literally can only code 😭

timid quartz
#

An edge just indicates some ā€œconnectionā€ between the nodes

#

Like it could be a road between a city

#

Or a reference

#

There’s different ways to think about it

spare quartz
#

well a reference is just another name for a datums relation to another datum

#

e.g. a pointer is a reference to memory address from a memory address

timid quartz
#

A valid graph ā€œcoloringā€ assigns ā€œcolorsā€ to nodes such that no two nodes connected by an edge have the same color

spare quartz
#

ohhh

timid quartz
# timid quartz

So like for this, a valid coloring is
0: red
1: blue
2: green
3: red
4: blue

#

Now

#

Since everything in programming is easy

#

Write me an algorithm that takes a graph

#

Oh wait I didn’t explain polytime

spare quartz
timid quartz
#

Yes

#

That’s valid

spare quartz
#

cool okay

timid quartz
spare quartz
#

i know what big o means

timid quartz
#

So O(1) or ā€œconstant timeā€ means that your program will always have the same runtime no matter the size of the input

spare quartz
#

just not how to actually calculate or applicate it

timid quartz
#

Polynomial time is O(n) meaning the programs runtime scales linearly with the input size

lavish dove
#

are you guys talking about graphs

spare quartz
#

he is

#

im listening

timid quartz
#

But had to give some background

spare quartz
lavish dove
#

wait so

#

why would you need a graph in polynomial time

#

isnt the point of a graph to be simple to read

spare quartz
#

its a challenge

timid quartz
#

Specifically you need to do a 3-coloring

#

In polynomial time

spare quartz
#

but what does polynomial time actually implicate

timid quartz
#

3-coloring means ā€œuse at most 3 colorsā€

spare quartz
#

as far as i understand running a time benchmark on an algorithm and deriving big o is useless

#

theres too many variables

timid quartz
#

So practically

#

Something that would be O(n) is for example idk

spare quartz
#

a loop

#

over n

timid quartz
#

Iterating over an entire array with a for loop

#

Yeah

#

Because the more elements in the array

#

The more loops you do

#

And it’s 1:1

spare quartz
#

oh wait so

#

big o isn't actually definitive of the actual algorithm

#

its just how it would perform if it were like

timid quartz
#

So for a 3-coloring of a graph, a polytime algorithm would only iterate over each node once

spare quartz
#

an abstract computation taken literally... i think

timid quartz
spare quartz
#

(wait no, big o is for the ALGORITHM, not the IMPLEMENTATION, at least on the actual execution layer)

spare quartz
#

lemme open roblox

timid quartz
#

Yeah big O is abstract

spare quartz
#

before i write some lua

#

let me send an image thats gonna make me explode

timid quartz
spare quartz
#

ooooookayyy graph representation,,,

timid quartz
#

It’s a thing that’s possible

#

One class I took was literally so stringent about big O

spare quartz
#

like taking this immediately at face value

timid quartz
#

We had to implement stuff for data structures within certain big O constraints

timid quartz
spare quartz
#

well.. kinda..

#

an element could itself pull another element

#

wouldn't that make that iteration... not "1" in n

timid quartz
#

well that wouldn’t really increase the big O

#

What WOULD increase the big O is if one of your elements were to cause another iteration over the entire stream

#

So like

spare quartz
#

a recursive function over an array?

timid quartz
#

while …
ā€œcaseā€ => while …

timid quartz
# spare quartz a recursive function over an array?

you probably don’t know sorting algorithms but ā€œnaiveā€ sorting algorithms are O(n^2) because, for each element in the array, you’re comparing it to every other element to find the right spot

spare quartz
#

all the others i just know because they're of use for (problem)

#

and promptly forget

timid quartz
#

what algo I’m curious

spare quartz
#

what everyone should know

#

bubble

timid quartz
#

ah yes the venerable bubble sort

#

a classic O(n^2) example

spare quartz
timid quartz
#

I’m personally an in-place quick sort fan

#

But I can’t implement it off the top of my head cause I’ve never needed to

spare quartz
#

ada (23, if you use a compiler compliant with the parallel RFC) makes a parallel divide/conquer sort pretty easy to implement, i forgot exactly which algorithm it is in the example though

timid quartz
#

anyways I’m going to sleep have fun 3-coloring graphs in O(n)

spare quartz
#

first i gotta find out how i wanna implement it first :<

#

good enough

timid quartz
#

And Node contain a number, color, and array of other Nodes to represent your edges

spare quartz
#

thats too much

#

at least what im thinking about

timid quartz
#

Well you gotta have the basics at least

#

You gotta have nodes with room for color in them

#

And you gotta store your edges somewhere

spare quartz
#

well

#

a graph is an abstract thing, right?

timid quartz
#

A graph can be used to represent many things

spare quartz
#

local colored = { [color]: { node ref } }

#

therefore no data needs to be in the node

#

hm

timid quartz
#

Yeah tbh you don’t need to store data so

spare quartz
#

yknow what i think i can just have graph be an array of graphs

#

a memory address is good enough

timid quartz
spare quartz
#

i guess that would make

#

the top node the graph, and the subnodes.. the nodes

timid quartz
#

There’s not really a top node in a graph

#

You’re thinking of trees

spare quartz
#

well, it has to be contained somewhere

timid quartz
#

A graph is looser than a tree

spare quartz
#

hm

#

would a tree be a graph IF the "top nodes'" connections didnt count as an edge

timid quartz
#

A tree is a graph

#

Always

#

It’s like how a square is always a rectangle but a rectangle isn’t always a square

#

A tree is just a type of graph

spare quartz
timid quartz
#

I’m asking you to make an algorithm to 3-color graphs in general

spare quartz
#

yes yes i just wanna make sure i understand everything

timid quartz
#

And a general graph may not have the same restrictions as a tree

spare quartz
#

anyways this suffices

timid quartz
#

I mean if you can understand how to represent edges there

#

It’s a lot easier for me to even think as just a Node object

#

And have the edges be an array of Node <-> Node pairs

spare quartz
#

well

#

the existence of a graph within another graph is enough to count as an edge between those two

timid quartz
#

Mm the only question is

#

Where does the edge connect

spare quartz
#

between the contained and container edge

timid quartz
#

Because if you have say ā€œA Bā€ and ā€œC Dā€ with an edge between them

#

What exactly two nodes does the edge connect?

#

This is important

#

An edge always connects exactly two specific nodes

spare quartz
timid quartz
#

Right that’s a tree

spare quartz
#

thinking cap time

timid quartz
#

But a graph could also be like

#

That

spare quartz
spare quartz
#

G4 just contains G1

#

(implementation wise this could cause errors...)

timid quartz
#

Ok well as long as you think you have things represented correctly

spare quartz
#

i just gotta think

timid quartz
#

If you hit a roadblock with your representation then I recommend the approach I mentioned earlier cause it’s very easy to reason with

#

Anyways I sleep

spare quartz
#

kohaku,,,

#

bayachao,,

#

<3

#

@timid quartz

type Graph = { Graph }
type ColorGraph = { [number]: { [Graph]: boolean } }
local graph: Graph = { {}, {}, { {}, {} } }

local function colorize(g1: Graph, gc: ColorGraph?): ColorGraph
    local gc = gc or {}
    local pc = (gc[1] or {})[g1]
    for _, g2 in g1 do
        local idx = if pc then 2 else 1
        local chk = gc[idx]
        if not chk then
            chk = {}
            gc[idx] = chk
        end
        chk[g2] = true
        colorize(g2, gc)
    end
    return gc
end
-- All elements are iterated thru exactly once, "O(n)"
-- CS is weird

print(graph)
print(colorize(graph))
#

plz confirm

lavish dove
#

woah

#

to make a bios for qemu all you haved to do is have 65536 aligned code

#

it even starts at rip=0

timid quartz
#

I can’t really visualize how you’ve made it

spare quartz
#

I’m on mobile rn,,,

#

The numbers below are the colors

#

The memory addresses are the nodes

#

And an edge is the existence of a node in* the containing node

timid quartz
#

yeah I think I just can't really visualize the edges

spare quartz
#

Tried

#

Oh god that looks awfully compressed

timid quartz
#

ok that's what I thought I just wanted to make sure

#

your graph is quite trivial

#

but you did successfully color it

#

now try coloring

#

. A
/
B -- C

#

wtf

#

ok thanks discord

spare quartz
#

Okay let me
Wake up

spare quartz
#

Not awake yet I lied

#

OK

#

now im awake

#

sooo

spare quartz
#
  • create a secondary map for [Node] -> color indexing
#

and

  • add a color queue based on g1/g2
spare quartz
#

accidentally discovered katakanam ode

spare quartz
#

@timid quartz okay back to coding graphs

#

hopefully this is "nontrivial" enouggh for your specifications

timid quartz
#

because this one is also fairly trivial

spare quartz
#

okay give it to me right now if its the same topic

timid quartz
#

ugh fine

spare quartz
#

cause chances are ill make this function specifically for that graph

timid quartz
spare quartz
timid quartz
spare quartz
#

ć°ć‚„ć”ć‚ƒćŠļ¼ļ¼ļ¼ļ¼ļ¼ļ¼ļ¼

timid quartz
#

and if a graph isn't 3-colorable you can uh

#

return whatever you like to indicate that

spare quartz
#

throw an error

#

šŸ‘

spare quartz
#

this is the type of problems kids always ask about

#

"when will we ever do this in the real world?"

#

it is a 1 in 1 billion chance of getting any practical use out of needing to color a devil summoning circle in your code

timid quartz
#

welll

#

in a compiler, graph coloring is useful

#

for register allocation

spare quartz
#

yeah but only mega nerds would call that graph coloring

#

i'd just call it a stack

#

anyways arrangement set, variable time

timid quartz
#

actually tbh

#

your algorithm can find the fewest possible colors

spare quartz
#

wdym

timid quartz
#

just

#

keep doing whatever you've been doing

spare quartz
#

i can't

#

not without adding unneeded complexity

#

that algorithm i came up with is specifically for trees with no circular references

timid quartz
#

:3

#

well since everything in programming is easy just tedious

#

ill wait

spare quartz
#

it is

#

you've in fact, given me a proof of that

#

by having to type out the self referential nightmare of this

timid quartz
spare quartz
#

you've given me a specification

#

i can do specifications

#

i don't need theory

timid quartz
#

well...

#

knowledge of a certain part of theory would have made this entire problem a lot easier

#

or at least arriving at the correct answer

spare quartz
#

well, if you could, tell me how this would actually matter in an application

timid quartz
#

a compiler doing register allocation is most forthcoming

spare quartz
#

because this might appear in your theory, but, it's not how something, at least, anything that i could come up with, would actually function

#

i love discord freezing

timid quartz
# timid quartz a compiler doing register allocation is most forthcoming

like when you're transforming IR (which has an infinite number of virtual registers) to assembly (which has a finite number of physical registers), to fit everything in the registers in an efficient manner, one approach is building a graph where the nodes represent variables and edges represent an "interference" (where both need to be in registers at the same time)

#

you then use the physical registers as colors

#

if you can color the graph then you're chill

#

if you can't then you have to "spill" one or more virtual registers onto the stack

spare quartz
#

why can't you just

#

not have registers exist at the IR level

#

and have it all be the stack

#

then during MCG make the top part stack register bound

timid quartz
#

I mean you COULD but consider the case where you want to minimize memory ops

timid quartz
#

and even then you often end up with multiple variables overlapping

#

even if you do store them all on the stack

#

requiring some management of physical registers

spare quartz
#

yeah thats why im saying making the top part of the IR stack actually register bound in the mc

#

and then the parts not in the register bound part of the ir stack are in the mc stack

#

(this may or may not actually work to be frankly honest: just how i would approach)

timid quartz
#

I mean that's a naive allocation yes

#

but it's not an optimal allocation

spare quartz
#

i dont see why not

timid quartz
#

Imagine you have a variable in the machine code stack right

spare quartz
#

sure

timid quartz
#

you could end up with a portion of your code where one of the variables stored in the registers gets stored to memory and isn't used for a time

#

but your allocation would probably just keep it in the register unused

#

you'd need some further kind of analysis to detect that

spare quartz
#

hmmm.. good point... but we can see where each part of the IR stack is used, and when it is used

#

if something isn't used very often that's in the upper half of the IR stack, we can lower it and bring up the thing ahead further up

#

if no further uses for that thing exist in the function anywhere ahead, we can just pop it

timid quartz
#

and now you've taken half a step towards what I mentioned anyways

#

cause that doesn't entirely solve the above problem it just reduces when it could occur and the impact it would have

spare quartz
#

well i don't see any way the graph would help solve it either

timid quartz
#

with each node+number representing a "virtual register" or "IR variable" (however you want to think about it cause they mean the same thing), with each edge representing variables being needed at the same time ("interfering"), and with each color being a physical register

#

this identifies that 1, 2, and 4 are never needed at the same time, so the blue register can be used for each of them whenever they're needed

#

whereas with your implementation (and still assuming 3 physical registers), you'd probably just have 1 and 2 permanently stored in registers, and use the last register to swap between 3, 4, and 5 that are stored on the machine stack

#

which while it works is less optimal

spare quartz
#

the allocation in each register would depend on how exactly 1/2 are used

#

if its in a spot of rich use of 1/2, then yeah they'd probably be stored for the entire duration

#

but if that suddenly becomes 1/4, 2 falls

timid quartz
#

but at this point you're basically doing what the graph does

spare quartz
#

i dunno i just can't think about how you can with graphs

timid quartz
#

but arguably less convoluted

#

well

#

the GRAPH is less convoluted

#

imo

#

I can reason with the graph a lot easier

spare quartz
#

for me the IR/MC stacks are just easier to keep in my head

#

i still have not typed out the pentagram vars yet 😭

timid quartz
#

and yes this is theory but this also gets applied via programming

#

so yknow...either doing register allocation via graph coloring would be really tedious for you...

#

or it wouldn't be as easy as you're saying...

spare quartz
#

it's as easy as im saying

#

just tedious again šŸ‘

spare quartz
#

just in another format

timid quartz
#

it's effectively the same thing

#

but more convoluted and probably less optimal

#

anyways you can stop with the graph coloring now

spare quartz
#

I DIDNT EVEN GET TO WRITE ANY CODE 😭

timid quartz
#

well if you want

spare quartz
#

stupid cs students tricking me into talking over actually doing my job

timid quartz
#

but I'll just go ahead and tell you

#

I had full intention of watching you burn yourself out solving a problem that people smarter than either of us combined are 90% sure is impossible

spare quartz
#

well those people are stupid

timid quartz
#

our current math and theory knowledge holds that finding the minimal coloring of a graph is not possible in polynomial time

#

you can look up NP-completeness if you want the theory

spare quartz
#

at least tree coloring is possible...

timid quartz
#

tree coloring is trivial

#

because a tree is basically a bipartite graph

#

and a bipartite graph is always 2-colorable

spare quartz
#

thats a word i do not know about funny man

timid quartz
#

(bipartite meaning you can separate the nodes of a graph into two "sides" where all the nodes on each side have no edges between them, only edges to the other side)

spare quartz
#

hmmm yes yes

#

i do not understand a word

timid quartz
#

this graph is bipartite

spare quartz
#

doing something weird within a certain iteration that is itself not iteration

#

is still polynomial time right

timid quartz
#

mmm it depends

spare quartz
#

like if i have a giant if chain, but none of the results causes an iteration, just some arithmetic or whatever

timid quartz
#

considering what we know it would probably make it not polynomial

spare quartz
#

but only given another condition

#

would that be polynomial

timid quartz
#

are these if statements traversing nodes

spare quartz
#

no

#

operations within the same and container node

timid quartz
#

mm it might remain polynomial but might not be correct in all cases

#

well

#

would PROBABLY not be correct in all cases

#

someone would probably find a counter case

spare quartz
#

thats a lot of probablys

timid quartz
# spare quartz

the gist of NP-completeness is this

  • some problems are solveable in polynomal time (we call the set of those P)
  • some problems are verifiable in polynomail time (we call the set of those NP)
    • verifiable means that someone can check it for correctness, so like they give you their "solution" and you can check it for correctness in polynomial time
  • some problems are neither (we call the set of those NP-Hard)
  • NP-complete is the overlap between NP and NP-Hard
  • somebody smarter than us made a giant proof for one particular problem showing that it is NP-Complete
    • since then we've found ways to "coerce" other problems into being that one particular problem, and by doing that, we can say those problems are also NP-Complete
spare quartz
#

just making a reference for myself ignroe

timid quartz
#

if you were to somehow solve the minimal coloring problem in polynomal time you would have proved P = NP and you'd probably make millions

spare quartz
#

could you imagine how much bayachao merch i could buy with that money

spare quartz
timid quartz
#

uhh the problem itself that has the giant proof is called "satisfiability" or SAT

spare quartz
#

so multiple collaborators i assume?

timid quartz
#

SAT is basicallt

#

you're given a boolean expression that's expressed as ANDs of ORs

#

so (... or ... or ...) and (... or ... or ...) and ...

spare quartz
#

oh wait is this logic

timid quartz
#

yeah

#

and finding a "satisfying" assignment s.t. the entire expression is true is NP-complete

#

the theorem that pertains to the NP-completeness of SAT is https://en.wikipedia.org/wiki/Cook–Levin_theorem

In computational complexity theory, the Cook–Levin theorem, also known as Cook's theorem, states that the Boolean satisfiability problem is NP-complete. That is, it is in NP, and any problem in NP can be reduced in polynomial time by a deterministic Turing machine to the Boolean satisfiability problem.
The theorem is named after Stephen Cook an...

spare quartz
#

let him cook

#

curious question

#

does logic account for like

#

take (A and B) or C

#

does both A and B and C have to be computed

#

or is short circuiting just A and B ok

timid quartz
#

I mean you could but that problem is of the wrong form for SAT

#

an input for SAT must have the form (... or ...) and (... or ...) and ...

timid quartz
spare quartz
#

trivial in what way

timid quartz
#

well you just find one thing to satisfy either clause of the or

#

and you're done

#

solveable in P

#

you can extrapolate that to any number of (... and ...) blocks

spare quartz
#

im just thinking about if https://en.wikipedia.org/wiki/Lazy_evaluation exists in this math crap

In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which avoids repeated evaluations (by the use of sharing).
The benefits of lazy evaluation include:

The ability to define control flow (structures) as abs...

timid quartz
#

it does

#

but again

#

for SAT

#

your problem is in the wrong form

timid quartz
#

because you can assign C = True and be done

spare quartz
#

hmm

timid quartz
#

you effectively "short circuit" the entire expression

spare quartz
#

soo

#

((A or A) and (B or B)) and ((not ((A or A) and (B or B))) and C)

#

would this be in the right form

timid quartz
#

im not sure about the nesting

#

yeah you can't have the nesting

spare quartz
#

computationally it's the exact same as what i've sent

#

ah ookay

#

hmmm then..

timid quartz
#

conjunctive normal form

#

that's the rules for it

spare quartz
#

peculiar

#

so i can't do not; a and b, but i can do not a; and; not b

#

is what im hearing

timid quartz
spare quartz
#

i wonder why that is (but i wont instigate on it since this theory stuff isn't something i plan to become a student in, just "know" for whenever)

timid quartz
#

idk some math jazz that math people agreed on

spare quartz
#

this is why we hate mathematicians

timid quartz
#

but the way that you can "prove" that the graph coloring problem is np-complete is by morphing it into SAT

#

you can consider 3-SAT where the only difference is that each disjunction only has at most 3 variables

#

for each variable you can construct a node in the graph

spare quartz
timid quartz
#

man I forgot the reduction

#

anyways

#

you can morph SAT into looking like the 3-coloring problem

#

and you can morph the 3-coloring problem into the k-coloring problem where k is some arbitrary number of colors >= 3

spare quartz
#

hold on i need to think about the problem

#

hold onto this for a second

#

there is an exploitable pattern here

#

in fact im pretty sure i've made it, just as a joke once while doing power simulation

#

just gotta figure out how i did it

#

also hold this

spare quartz
#

HOLY SHIT

proud creek
#

Orb

spare quartz
spare quartz
#

@timid quartz you type of post

timid quartz
#

real

spare quartz
#

ćƒ•ć‚”ćƒƒć‚Æ

timid quartz
#

Stack cringed architectures like the JVM are basically just bloated Turing-complete reverse Polish notation calculators

spare quartz
#

i will kill you

#

also wdym by "(reverse) Polish notation calculators"

timid quartz
#

Google it

spare quartz
#

i did

#

i saw the syntax was "a; b; op"

timid quartz
#

Yes

spare quartz
#

which is how every architecture works

#

the jvm included

timid quartz
#

Hold

spare quartz
#

PUSH A
PUSH B
ADD <pops A, B>

#

MOV EAX, 40
MOV ECX, 2
DIV [[EDX]:EAX, ECX]

#

also twitter is down ā˜¹ļø

#

no more bayachao content for me

timid quartz
#

Yeah so

#

Basically every RPN calculator I’ve seen and used also operates similar to Java with a stack

#

4<ENTER>
3<ENTER>
+<ENTER>

spare quartz
#

yeah thats how every standard architecture works though

#

not specially the jvm

timid quartz
spare quartz
#

well

timid quartz
spare quartz
#

that just means you have to write your own jvm

#

:3

timid quartz
#

pixiv time

spare quartz
#

also their new game won an award so thats cool

timid quartz
spare quartz
#

i guess so

timid quartz
#

Because like you said in JVM bytecode you’d do like PUSH PUSH ADD

spare quartz
#

yeah

#

USUALLY you'd do the same in x86/ARM with MOV reg/reg, but that could be out of order

timid quartz
#

whereas with like x86 you’d do LW into reg LW into reg ADD both regs

#

I think the difference that I noticed was that the arithmetic operations in the JVM implicitly use the stack whereas other architectures may be explicit

#

Arithmetic operations among other things

#

Similar to how if you were to press the plus key on an RPN calculator, you would implicitly use the top two items on the stack

spare quartz
#

honestly im not sure what architecture the jvm is closest to (aside from its discrete details like stack-based)

#

i know it's kind-of a RISC

#

since most instructions are a byte long, and those that aren't have discrete sizes

spare quartz
#

wdym by this

#

implicit, in what way?

timid quartz
#

stack-cringed*

spare quartz
#

i should NEVER give you another post from fedi again

timid quartz
spare quartz
#

well, the same also happens in x86

timid quartz
#

the use of values from the stack is implicit

timid quartz
spare quartz
#

a DIV operation for example

#

it implicity operates and returns in D/A

#

the only operand is the divisor

timid quartz
#

hm didnt know that

spare quartz
#

MUL too

timid quartz
#

i dont know that much x86 :p

spare quartz
#

you should make your own cpu...

timid quartz
spare quartz
#

itlll give you extra crediot..

timid quartz
#

noitwont

spare quartz
#

:<

spare quartz
#

pizza TTL 41 minutes

timid quartz
#

how many hops for the pizza

spare quartz
#

i am not writing an extension to TCP for pizza

#

this is my own system.

timid quartz
#

well good luck measuring time between multiple hops :3

spare quartz
#

japan postal service and usps... would like to talk to you..

spare quartz
#

BOOTLAODER DEV RESUMATION time because i have been lazy

spare quartz
#

it just hit me

#

<CR> isnt useless as a character

#

its just dated

pallid loom
#

iirc by default the arduino ide does both \r & \n for newlines

spare quartz
#

not that

#

most programs see it as virtually the same as <SP>

pallid loom
#

"In both ASCII and Unicode, the carriage return is assigned code point 13 (or 0D in hexadecimal); it may also be seen as control+M or ^M. In character and string constants in the C programming language and in many other languages (including representations of regular expressions[2][3]) influenced by C, \r denotes this character.[4]"

spare quartz
#

im just looking at replicating QEMU and LF* is for y++ and CR is for x = 0

snow oak
#

dear programmers in the chat...

local vm_module = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local modules_folder = ReplicatedStorage:WaitForChild("Modules")
local events_folder = ReplicatedStorage:WaitForChild("Events")
local viewmodels_folder = ReplicatedStorage:WaitForChild("Viewmodels")

local current_camera = workspace.CurrentCamera

vm_module.functions = {
    on_equip = function(tool: Tool)
        if not tool then
            return
        end
        
        local possible_vm = viewmodels_folder:FindFirstChild(tool.Name)
        
        if possible_vm then
            local real_vm = possible_vm:Clone()
            
            real_vm.Parent = vm_module.objects.Camera
            vm_module.functions.viewmodel_loop(real_vm)
        end
    end,
    
    on_unequip = function()
        local vm = current_camera:FindFirstChildOfClass("Model")
        
        if vm then
            if vm:FindFirstChild("CameraBone") then
                vm:Destroy()
            else
                return
            end
        else
            return
        end
    end,
    
    viewmodel_loop = function(vm)
        if not vm then
            return
        end
        
        RunService.RenderStepped:Connect(function()
            vm:PivotTo(current_camera.CFrame)
        end)
    end,
}

return vm_module
spare quartz
#

which i found peculiar

pallid loom
snow oak
spare quartz
pallid loom
snow oak
#

it works

#

just looking for any tips

pallid loom
#

are you trying to do qemu in mc

spare quartz
#

no that's too simple

pallid loom
#

and to be clear we're talking about

#

qemu

#

the virtual machine software

#

not something else

spare quartz
#

this is our implementation of a BIOS and x86 cpu for our mod, im just trying to replicate QEMU's bios since most operating systems are aqquainted with it

spare quartz
pallid loom
#

why

spare quartz
#

cause its fun

pallid loom
#

incredible

#

incredible amounts of radiating autism

spare quartz
#

anyways the issue is X isn't being calibrated properly on our simulator, which causes a deficit of exactly 1 blank line

#

i am not autistic .

pallid loom
#

acoustic

snow oak
# snow oak dear programmers in the chat... ```lua local vm_module = {} local ReplicatedSto...
local vm_module = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local modules_folder = ReplicatedStorage:WaitForChild("Modules")
local events_folder = ReplicatedStorage:WaitForChild("Events")
local viewmodels_folder = ReplicatedStorage:WaitForChild("Viewmodels")

local current_camera = workspace.CurrentCamera

function vm_module.on_equip(tool: Tool)
    if not tool then
        return
    end

    local possible_vm = viewmodels_folder:FindFirstChild(tool.Name)

    if possible_vm then
        local real_vm = possible_vm:Clone()

        real_vm.Parent = vm_module.objects.Camera
        vm_module.functions.viewmodel_loop(real_vm)
    end
end

function vm_module.on_unequip()
    local vm = current_camera:FindFirstChildOfClass("Model")

    if vm then
        if vm:FindFirstChild("CameraBone") then
            vm:Destroy()
        else
            return
        end
    else
        return
    end
end

function vm_module.viewmodel_loop(vm)
    if not vm then
        return
    end

    RunService.RenderStepped:Connect(function()
        vm:PivotTo(current_camera.CFrame)
    end)
end

return vm_module

changed it around a bit

spare quartz
#

no. ocd and adhd

#

clearly superior

snow oak
#

am i flooding the chat

#

i think i am

pallid loom
#

no you're fine

#

we're just yapping

spare quartz
#

you should look into sending your messages as files but otherwise its fine

pallid loom
#

sir/ma'am have you looked at your computer.

spare quartz
#

yes i have actual ocd from my dad

pallid loom
#

there are cables everywhere.

spare quartz
#

not the "perfectionist" ocd thats on the interwebs

spare quartz
pallid loom
#

somehow...

#

just a matter of time until something blows up

#

is the HDD still hanging

spare quartz
#

yeah

pallid loom
#

incredible

spare quartz
#

these SATA cables are no joke

#

that specific hard drive isnt spinning rn though

#

so if it does fall it'll be fine

spare quartz
#

you should probably be early returning

pallid loom
spare quartz
#

cause its in a RAID array

pallid loom
#

in what raid array

#

any raid array keeps all of the disks spinning does it not

spare quartz
#

no

#

theres no activity rn so why would it

pallid loom
#

oh btw i've just come to a great realisation

#

my server is under my 3d printer

#

my 3d printer does resonance calibration

spare quartz
#

also the hanging hard drive is frrom 2007 so ill be surprised if it dies by shock over age

pallid loom
#

which shakes the entire room

#

surprised my hdds are still running

spare quartz
#

i don't think modern hdds are really susceptible to noise like that

#

just physical shock

pallid loom
#

server is in the cage

#

you can see the faint white light of the gpu

spare quartz
#

how does that shake the room

pallid loom
#

you'd be surprised

spare quartz
pallid loom
#

In this video, I walk you through the first power-on of the Bambu Lab A1 Combo 3D printer and explore its impressive features: Motor Noise Cancellation and Vibration Compensation. I’ll share what happened during the initial setup, calibration process, and how these advanced features help improve print quality and reduce noise.

Watch the printer...

ā–¶ Play video
#

just click play it's at the correct timestamp

spare quartz
pallid loom
#

keep in mind it's basically on a lever since it's on the 2 stupid boxes

#

there's also horror stories of printers just fucking vibrating to hell while printing and falling off tables

#

so that's cool

pallid loom
# spare quartz

i really dont know how any of this works in its current state

spare quartz
#

its very easy to see how it does work

pallid loom
#

i refuse to believe

#

the hdd

#

is that the next advancement in your setup

spare quartz
#

ohgyaygh

#

that was close

#

I nearly dropped my 2 liter of soda

pallid loom
#

HOLY SHIT

spare quartz
#

I should dust my pc soon

pallid loom
#

NOT A REAL AMERICAN

#

!!!!

#

LITERS?!?!?!?

spare quartz
#

yeah

#

2.1 quarts šŸ‡ŗšŸ‡ø

pallid loom
#

you have a usb wifi dongle

#

but use the pci one

spare quartz
#

no

#

i have a bluetooth dongle

#

my wifi dongle is in storage

pallid loom
spare quartz
#

LOL

#

im 99% sure

#

thats hooked up to my tablet

pallid loom
#

drawing tablet i assume

spare quartz
#

yeah

pallid loom
#

what fucking drawing tablet uses hdmi

#

i've only seen usb ones

spare quartz
#

its has a screen on it

#

so it uses USB-C & VGA/HDMI

#

greater color accuracy than my 144 hz monitor but is 60 hz

#

so i switch between the two for tasks

pallid loom
#

i mean i would hope its more color accurate

spare quartz
#

the difference is pretty small but yeah i'd hope so too

#

it costs $200 more than my 144 hz monitor

pallid loom
#

curiosity

spare quartz
#

testing something and got too lazy to change it back

#

additionally i get a cool ime

pallid loom
#

incredible

spare quartz
#

ć°ć‚„ć”ć‚ƒćŠć€‚ć€‚ć€‚ļ¼œļ¼“

pallid loom
#

atp you should buy a framework laptop

#

i'd want to see in what fucked up way you could use it

spare quartz
#

thats expensive..

#

how much does one cost

pallid loom
#

minimum of 1k usd

spare quartz
#

waow thats a lot

pallid loom
#

but you're a future defense contractor you have 20 billion in your pockets

spare quartz
#

id rather make a computer out of 250 pi picos

pallid loom
#

Lockheed martin junior

pallid loom
spare quartz
#

well

#

i did

pallid loom
#

how far

spare quartz
#

but you'll never guess what i did to my pico after running ada on it

#

i fried it ā˜¹ļø

pallid loom
#

are you talking about the fucking aca-

#

expected

#

How'd you do it

#

5v to gnd or something else

spare quartz
#

fucked around with a metal probe on the pins

#

it was shockingly resillient

pallid loom
#

never really used a pi pico

spare quartz
#

they're cool but mega limited

pallid loom
spare quartz
pallid loom
#

20 rpi 5 cluster

spare quartz
#

thats so much

pallid loom
#

4 GB ram versions exist

spare quartz
#

what about 256 mb

pallid loom
#

btw move to #1267583072728121384

lavish dove
lavish dove
#

qemu's bios is ligit just seabios

spare quartz
#

yeah

spare quartz
#

y synced

#

just need to fix scrolling

spare quartz
lavish dove
spare quartz
#

accidentally maed this cool fx

spare quartz
proud creek
spare quartz
lavish dove
#

terminal from a game

spare quartz
#

post made by a rustlet i decided to send ehre

#

of course, Ada wins, always has won, but yeah

proud creek
#

āŒ

spare quartz
spare quartz
#

go back to coding tz.