egg|nomz|egg changed the topic of #kspacademia to: https://gist.github.com/pdn4kd/164b9b85435d87afbec0c3a7e69d3e6d | Dogs are cats. Spiders are cat interferometers. | Космизм сегодня! | Document well, for tomorrow you may get mauled by a ネコバス. | <UmbralRaptor> egg|nomz|egg: generally if your eyes are dewing over, that's not the weather. | <ferram4> I shall beat my problems to death with an engineer.
<awang_> UmbralRaptor: ? Feel like I'm missing a joke here
<UmbralRaptor> awang_: er, for which line?
<awang_> UmbralRaptor: 01101011
<awang_> Well, I guess that applies to most of the things in here, too
<awang_> (missing the joke)
<UmbralRaptor> awang_: emitting binary in response to your "the bots have spoken" comment.
<UmbralRaptor> Granted, it would be better if I had translated something in ASCII…
<awang_> Ah
<awang_> Yeah, that's what I thought you did
<awang_> "107? 0x6B? What?"
UmbralRaptop has joined #kspacademia
UmbralRaptop has quit [Remote host closed the connection]
UmbralRaptor has quit [Read error: Connection reset by peer]
UmbralRaptop has joined #kspacademia
<UmbralRaptop> … I think a bus just ditched us?
<UmbralRaptop> What "should" have been Green 2 was out of service.
<UmbralRaptop> And the app switched to showing the next bus being in ~45 minutes.
awang_ has quit [Ping timeout: 207 seconds]
<UmbralRaptop> Yeah, I think they just dropped a bus from service for some reason.
awang has joined #kspacademia
<kmath> <sumnerd> The ChemCam is cool. https://t.co/hCQywhVRQQ
e_14159 has quit [Ping timeout: 182 seconds]
e_14159 has joined #kspacademia
<UmbralRaptop> !choose eat|be lazy
<Qboid> UmbralRaptop: Your options are: eat, be lazy. My choice: eat
<UmbralRaptop> ;choose eat|be lazy
<kmath> UmbralRaptop: be lazy
<UmbralRaptop> And <egg|bot|egg> is asleep…
* awang 🔪 iTerm
<bofh> rofl
<soundnfury> UmbralRaptop: why not both?
<UmbralRaptop> lazy eating ≠ lazy evaluation
<soundnfury> Clearly, you should eat some Curry.
<UmbralRaptop> Naan sure that's as easy as described. [I couldn't come up with a computing pun]
<soundnfury> Is that a quiet Naan or a signalling Naan?
<UmbralRaptop> … now I'll never know how much bread costs!
icefire has quit [Read error: Connection reset by peer]
<egg> !wpn whitequark
* Qboid gives whitequark a bootstrapped transformer
<egg> !wpn Fiora
* Qboid gives Fiora a Wasserstein lemma
<egg> !wpn bofh
* Qboid gives bofh a Wasserstein induction
<egg> Ꙩ_ꙩ
<egg> !wpn UmbralRaptop
* Qboid gives UmbralRaptop a fermium Brand New Photoneutronic Engine
<soundnfury> !wpn egg
* Qboid gives egg a Renesas interhalogen
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Ping timeout: 186 seconds]
<UmbralRaptop> !wpn egg
* Qboid gives egg a solderless magnesium gauntlet
* UmbralRaptop 🔪 sleep
egg|phone|egg has joined #kspacademia
egg|cell|egg has quit [Read error: Connection reset by peer]
egg|cell|egg has joined #kspacademia
egg|mobile|egg has joined #kspacademia
egg|cell|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has quit [Ping timeout: 186 seconds]
ferram4_ has joined #kspacademia
ferram4 has quit [Read error: Connection reset by peer]
tawny has quit [Ping timeout: 207 seconds]
ferram4_ has quit [Read error: -0x1: UNKNOWN ERROR CODE (0001)]
ferram4 has joined #kspacademia
awang has quit [Ping timeout: 207 seconds]
ferram4 has quit [Read error: Connection reset by peer]
ferram4 has joined #kspacademia
egg|phone|egg has joined #kspacademia
egg|mobile|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has joined #kspacademia
awang has joined #kspacademia
ferram4 has quit [Read error: Connection reset by peer]
ferram4 has joined #kspacademia
awang has quit [Ping timeout: 207 seconds]
APlayer has joined #kspacademia
egg|cell|egg has joined #kspacademia
egg|mobile|egg has joined #kspacademia
egg|cell|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has quit [Ping timeout: 186 seconds]
awang has joined #kspacademia
<awang> !wpn -add:wpn bootstrap
<Qboid> awang: Weapon added!
<awang> !wpn egg
* Qboid gives egg a Hausdorff correction
<awang> !wpn UmbralRaptop
* Qboid gives UmbralRaptop a metabotropic solution which strongly resembles a basket
APlayer has quit [Ping timeout: 383 seconds]
<bofh> !wpn awang
* Qboid gives awang an extragalactic implosion
<bofh> !wpn egg
* Qboid gives egg an adiabatic fancy trie
<bofh> !wpn UmbralRaptop
* Qboid gives UmbralRaptop an ordinal
<bofh> !wpn whitequark
* Qboid gives whitequark a buttery scale-like vtable
* awang collapses into a black hole
egg|work|egg has quit [Ping timeout: 180 seconds]
* UmbralRaptop x_x
<kmath> <asrivkin> I just realized that particle sizes in asteroid regoliths basically run from ground espresso to whole beans.
<Fiora> awang: oh i guess i'm an llvm dev. do you still need one
<awang> Fiora: Sort of? It's not urgent, if you have other things to do
<Qboid> awang: schnobs left a message for you in #RO [28.02.2018 15:48:53]: "I wanted to start a sim, had KRASH complain about a missing part, bought it, started sim."
<Qboid> awang: schnobs left a message for you in #RO [28.02.2018 15:55:57]: "...and that's all there ist to it."
<Qboid> awang: schnobs left a message for you in #RO [28.02.2018 15:57:06]: "apparently KRASH applies it's settings first, then checks the vessel. If the actual SIM doesn't run, KRASH settings are not reverted."
<Qboid> awang: schnobs left a message for you in #RO [28.02.2018 16:03:22]: "I appended an existing KRASH issue."
<awang> There should be something in the llvm-dev mailing list, if you follow that
<awang> Short version is I'm seeing some funky assembly and I'd like to know why
<Fiora> sure, point me to it
<Fiora> i don't actually work on x86 but statistically i'm one of about a dozen people likely to be able to answer the "why funky assembly" question
<awang> Ah
<awang> Just my luck, then
<awang> Only a dozen?
<awang> Sort of surprised
<awang> I expected more for a compiler the size of LLVM
<Fiora> well it depends on the part of the compiler.
<Fiora> most people work on either the frontend or midend (yes i know midend is a dumb name)
<awang> Ah
<Fiora> of backend people, i keep getting asked about selectiondag and regalloc-adjacent issues because hardly anyone else knows them either
<awang> That's where all the fun stuff is?
<Fiora> no no, the backend is the fun part.
<Fiora> all those midend optimizer people are weird.
<Fiora> them and their TARGET-INDEPENDENT IR, weirdos
<Fiora> i'm slightly exaggerating but if this problem is in regalloc, well
<awang> heh
<Fiora> basically i spent 3 years in the backend and now i'm stuck in the gullet of the monster
<awang> Do most compiler devs talk smack about each other? :P
<awang> I think it's in regalloc? The regalloc log started with a mul, then an add, then an inc
<awang> And ended up with the spill/reload somewhere by the end of the log
<Fiora> I'm JOKING about that, they're cool
<Fiora> i've written IR passes anyways
<Fiora> anyways i'll poke at it in a bit
<Fiora> actually have a similar problem for work insomuch as "hey this upstream change makes these tests take extra instructions, fix it"
<awang> Alright
<awang> Thanks for taking the time!
* awang 🔪 CMake
StCipher has joined #kspacademia
StCypher has quit [Ping timeout: 186 seconds]
<Fiora> sorry, was heading to work
<Fiora> okay, so, i think i know what's going on here.
<Fiora> firstly, the CALL clobbers xmm0.
<Fiora> secondly, the CALL returns a value in xmm0. this value gets used immediately after
<Fiora> thus there's a COPY %22, xmm0
<Fiora> a physreg copy
<Fiora> it wisely first allocates xmm0 to eliminate this copy.
<Fiora> this means that the first MULSDrm after the CALL now outputs to xmm0.
<Fiora> thus, the other value used by ADDSDrr must go in xmm1.
<Fiora> now it has also, independently, decided to use xmm0 at the top of the loop.
<Fiora> because of the calling convention returning xmm0, it can't keep the values assigned to xmm0 entirely in a register. they must go on the stack at some point.
<Fiora> hmm
<Fiora> okay so basically what's going on here, as far as I can tell (i'll give myself 60% confidence), is that the allocator (as configured by x86, at least) does not understand two concepts
<Fiora> 1) "spilling" by using other registers instead of the stack
<Fiora> 2) using registers other than xmm0 in order to avoid getting clobbered by the call (i'm not entirely sure about calling ocnventions here though...)
* Fiora keeps looking
<egg|mobile|egg> !Wpn Fiora
* Qboid gives Fiora a temperate egg|zzz|egg
<egg|mobile|egg> Um
<Fiora> ah, I see, it's recursive.
<Fiora> ah....... that's why.
<Fiora> or wait no, that's getlocalvalue vs getvalue...
egg|phone|egg has joined #kspacademia
egg|mobile|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has quit [Read error: Connection reset by peer]
egg|phone|egg has joined #kspacademia
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Ping timeout: 186 seconds]
egg|phone|egg has joined #kspacademia
<Fiora> yeah okay basically the fun here is caused by the fact that all the livintervals get split by the call, which clobbers all xmms
<Fiora> so nothing can be kept in xmms around the loop
<Fiora> there you go, calling conventions suck. stop using function calls, function calls are for squares.
<iximeow> Fiora: i think the more confusing one was the `mov [rsp + 4], xmm0; mov xmm0, [rsp + 4]` after the call
egg|cell|egg has quit [Ping timeout: 182 seconds]
<iximeow> literally those two instructions immediately adjancent with nothing reading [rsp + 4] before being overwritten (as far as i could see, anyway)
<Fiora> rsp+8 you mean?
<iximeow> or no, sorry, going from memory - it was `mov [rsp + 4], xmm0; mov xmm1, [rsp + 4]` i think
<iximeow> probably!
<UmbralRaptop> egg: please stop violating the no clone theorem.
UmbralRaptop has quit [Quit: Bye]
UmbralRaptop has joined #kspacademia
<Fiora> as far as i can tell that's happening because of the live range splitting
<Fiora> but it's still beyond me exactly how it gets there
<Fiora> it hits the live range for that value which is pretty complex and spans multiple blocks and keeps splitting it down and at some point it spills at the end of the liverange and then reloads it
<Fiora> the live range between the addsd and the loop backend was split so the loop backedge got assigned xmm0
<Fiora> and the addsd got reassigned to xmm1 to avoid conflicting with its input
<Fiora> and the register allocator puked all over the floor like an idiot
<iximeow> \o/
<iximeow> stop doing functions, write assembly by hand
<awang> Fiora: Sorry, was in a meeting
<awang> I'd love to get rid of the call
<awang> Probably going to take some restructuring at least
<awang> Or make the calls in a loop before, then sum them up separately after
<awang> Fiora: Any idea why r13 isn't used at all?
APlayer has joined #kspacademia
technicalfool_ has joined #kspacademia
Stratege_ has joined #kspacademia
<awang> The analysis makes sense
BPlayer has joined #kspacademia
<awang> Now to figure out 1) How to get rid of that function call, and 2) how to convince Clang that it doesn't need to reload the vtable pointer every iteration
egg|cell|egg has joined #kspacademia
egg|phone|egg has quit [Read error: Connection reset by peer]
Parenthesie has quit [Ping timeout: 186 seconds]
Stratege has quit [Ping timeout: 186 seconds]
Parenthesie has joined #kspacademia
<awang> Fiora: Thanks for taking the time to look! That was quite helpful
Technicalfool has quit [Ping timeout: 186 seconds]
e_14159 has quit [Ping timeout: 186 seconds]
e_14159 has joined #kspacademia
APlayer has quit [Killed (NickServ (GHOST command used by BPlayer))]
BPlayer is now known as APlayer
<Fiora> awang: there's a function call because it's a virtual call
<Fiora> my suggestion would be to stop using C++
* Fiora runs
egg|phone|egg has joined #kspacademia
egg|cell|egg has quit [Ping timeout: 207 seconds]
<awang> Fiora: Yep, I know. Trying to see if I can at least move the function call elsewhere where the clobbering won't be as much of an issue
<awang> And yeah, I'd love to stop using C++ and use something else
<awang> Unfortunately, it's going to be a bit difficult to convince my boss that a rewrite is a good idea
<awang> Suggestions for a different language?
tawny has joined #kspacademia
<egg> Fiora: squares?
<awang> Hmmm
<awang> The called function technically qualifies for [[gnu::const]]
<awang> Wonder if that would help
egg|phone|egg has quit [Read error: -0x1: UNKNOWN ERROR CODE (0001)]
egg|cell|egg has joined #kspacademia
<kmath> <FioraAeterna> @f1ac5 there's a few other possibilities! ⏎ ⏎ 1. you have a fetish for floating point ⏎ 2. you need predictable wrongnes… https://t.co/1lxO0i9PIk
<SnoopJeDi> egg, as an actually for reals numerics eggspert can you clarify your personal position on this compiler feature
egg|cell|egg has quit [Ping timeout: 186 seconds]
<egg> I'm not sure I'm an eggspert, but I definitely don't use fast math
<egg> (my poor compensated summations!)
<egg> wat #1737
<Qboid> [#1737] title: Distance Limit from Kerbol | As of now, Principia only seems to work if you are pretty much inside the Orbit of Eelo. If you go further, Principia stops showing any predictions, and you can´t create new flight plans. This prevent... | https://github.com/mockingbirdnest/principia/issues/1737
<kmath> <jgerity> uhhh https://t.co/LDSn4vBm64
egg is now known as egg|nomz|egg
<UmbralRaptop> egg|nomz|egg: Wait, are Outer Planets even stable in Principia?
<SnoopJeDi> egg|nomz|egg, m-magic
UmbralRaptor has joined #kspacademia
Raptop has joined #kspacademia
Raptop has quit [Client Quit]
Raptop has joined #kspacademia
UmbralRaptor has quit [Read error: Connection reset by peer]
UmbralRaptop has quit [Ping timeout: 383 seconds]
* awang 🔪 virtual functions
UmbralRaptop has joined #kspacademia
Raptop has quit [Read error: Connection reset by peer]
UmbralRaptop has quit [Remote host closed the connection]
UmbralRaptop has joined #kspacademia
<awang> Wat
<awang> Clang just didn't inline a getter function
<awang> o_O
<SnoopJeDi> bofh, upon further consideration, what *actually* bothers me about that two: calling it a sanity check instead of magic
<SnoopJeDi> but I like it a lot out of context regardless of how proper any of it is
* UmbralRaptop casts "Detect Sanity"
<SnoopJeDi> LOL
<egg|nomz|egg> UmbralRaptop: i don't know, but there is no known limit as described by the user
egg|nomz|egg is now known as egg|zzz|egg
<egg|zzz|egg> UmbralRaptop: https://twitter.com/cmrx64/status/968596754026369024 any ideas?
<kmath> <cmrx64> Ok so the data is going to be some database of gravitational parameters. Hey @eggleroy, what parameters can complet… https://t.co/b45QGPE19C
<UmbralRaptop> o_O
icefire has joined #kspacademia
UmbralRaptor has joined #kspacademia
UmbralRaptor has quit [Client Quit]
UmbralRaptop has quit [Read error: Connection reset by peer]
UmbralRaptop has joined #kspacademia
<bofh> SnoopJeDi: LOL
APlayer has quit [Ping timeout: 182 seconds]
<awang> Does it make sense to have a "count" of something as a unit?
<awang> e.g. 5 apples vs 5 oranges
<awang> Does adding them make sense?
<awang> Comparison... sort of makes sense?
<SnoopJeDi> Counts certainly makes sense, comparison is a strong Maybe
<SnoopJeDi> as a good counterexample: you can have counts of both thousands and billions, but comparing those counts would generally be nonsense
<awang> I'm trying to figure out how to get a "pixel" unit in this library
<awang> True
<egg|zzz|egg> clearly you should have a quantities library like principia
<SnoopJeDi> awang, in general though, addition is a *defined* operation: it has no intrinsic "sense," the operation is instead defined by what does make sense
<SnoopJeDi> although usually we're "just" talking about ℝ in which case there's solid enough ground beneath our feet
<SnoopJeDi> ℝ or ℂ
<awang> egg|zzz|egg: I wish :(
<awang> I need to level up my template mastery before I can do that though
<SnoopJeDi> graphics: here be dragons
<awang> SnoopJeDi: Makes sense, I think?
<SnoopJeDi> the math associated with screen space and all the nutty kinfolk is at-times problematic
<SnoopJeDi> although one of the coolest CS papers I've ever seen was a Pixar submission to SIGGRAPH that wrote down a scene render as a convolution integral :D
<awang> Yeah, unfortunately I have to write something which takes in images, some rules defined in mm, and spit out a result
<awang> So I'd love to have a way to stave off my stupidity when it strikes
<SnoopJeDi> awang, are you familiar with dpi as a measurement?
<egg|zzz|egg> !choose Nomal|Runge-Kutta integrators|sleep
<Qboid> egg|zzz|egg: Your options are: Nomal, Runge-Kutta integrators, sleep. My choice: sleep
* egg|zzz|egg zzz
<SnoopJeDi> dpi/ppi
<awang> SnoopJeDi: I know of it, but I know little about it
<SnoopJeDi> might be helpful to touch on it
<SnoopJeDi> awang, are you only concerned with the *data*, or are you also trying to output at a known physical size?
<SnoopJeDi> output an image I mean
<awang> Uh
<SnoopJeDi> hrm no not "output," I should say "display"
<awang> I need to eventually spit out a report with some results in mm
<awang> And also display those results
<SnoopJeDi> drawing images at a reliable physical size is one of those Really Hard Problems That Seems Like It Should Be Easy
UmbralRaptor has joined #kspacademia
UmbralRaptor has quit [Client Quit]
UmbralRaptop has quit [Read error: Connection reset by peer]
UmbralRaptop has joined #kspacademia
<awang> Yeah
<awang> The idea is to have the user indicate what the scale is
<awang> Then use that to translate between measurements for the report and what will be displayed on-screen
UmbralRaptop has quit [Read error: Connection reset by peer]
<awang> So hopefully that combined with strong units will fix issues
UmbralRaptor has joined #kspacademia
<Fiora> awang: i was mostly joking about the C++ thing
<Fiora> i moreso meant, don't use C++ *features* that have a cost that you don't like
<Fiora> btw, sorry for disappearing, morning was covered in meetings
<Fiora> so like, for example, if your vtable call is stopping the compiler from inlining it, and you believe it really should be inlineable, don't make it a vtable call
<egg|zzz|egg> Fiora: what do you mean by squares
<SnoopJeDi> are you not familiar with that English idiom, egg|zzz|egg?
<Fiora> according to urban dictionary
<Fiora> square A noticeably unhip, mainstream individual, a straight. Someone either ignorant or disinterested of underground subcultures. The antithesis of a hipster.
<egg|zzz|egg> SnoopJeDi: I wasn't
<Fiora> 1. (n; adj) A person who is regarded as dull, rigidly conventional, and out of touch with current trends.
<awang> Fiora: Still, I'm interested in things better than C++
<egg|zzz|egg> Fiora: huh, thanks
<awang> (and sorry, I tend to miss jokes)
<SnoopJeDi> ah okay, it's a fairly old expression
<UmbralRaptor> Okay, but what is a Square-Enix?
<Fiora> oh i don't actually know, I only use C++ in my dayjob because that's what LLVM is written in
<awang> No problem with meetings, I get the same from time to time
<Fiora> and most of the code i work with is written in C-like languages (e.g. shaders)
<awang> Yeah, idk what I'm going to do about that vtable call
<Fiora> why does the function have to be virtual?
<UmbralRaptor> egg|zzz|egg: I'm not sure I can five satisfactory answers to that person on Twitter. =\
<awang> Because the original author defined it that way?
<awang> Pretty substantial OO library thing
<awang> I don't actually know if the virtual part makes sense
<Fiora> oh. i thought you were writing this coe
<Fiora> *code
<Fiora> i mean, virtual is a concept. if it doesn't have to be virtual, don't make it virtual, etc
<awang> Well, it *is* my code now
<awang> Yeah, I'll see what I can do
<Fiora> compilers aren't generally able to conceptually change your code
<Fiora> you gotta make the code express what you want before the compiler can optimize it right
<awang> It's just placement new screwing things up :(
<iximeow> (devirtualization is one of my favorite jit things ever)
<SnoopJeDi> Fiora, is "able" the best way to say that? (serious question)
<awang> Well, that and c++ const being a lie
<Fiora> as opposed to like uhhhh what
<Fiora> i dont even know what placement new is, sob
<awang> I tried putting all the virtual calls before the loop to get them out of the way, see if the rest of the loop could be sped up
<Fiora> yeah this is one of the benefits of jits, wild speculative devirtualization of literally everything. llvm can do some forms of devirtualization but i think it requires LTO
<awang> No such luck :(
<kmath> <ManishEarth> @whitequark pawcement mew ⏎ ⏎ meowlocation
<awang> Fiora: Placement new -> construct things in preallocated memory
<awang> Apparently an object can overwrite itself and its vtable with that
<Fiora> vtables only apply to virtual functions!
<awang> Which is one reason the loop has to load the vtable pointer over and over and over again
<Fiora> if it's a non-virtual function there won't be a vtable pointer
<SnoopJeDi> Fiora, I don't have any compiler-fu hence my question but like, do you mean they aren't able to by definition of what a compiler is, or that conventionally compilers are designed to not do it because that would be Generally Bad
<Fiora> SnoopJeDi: the former
<SnoopJeDi> oh interesting
<Fiora> optimizations that *conceptually change* the way a program works are generally classified as "heroic"
<SnoopJeDi> corollary question: does that mean a lot of compilers aren't...actually compilers?
<SnoopJeDi> or just that we/languages suck at describing ideas clearly
<Fiora> insomuch as they make for extremely good papers on carefully crafted programs designed to satisfy the absurd constraints on those transformations
<Fiora> and are completely useless on real-world code
<Fiora> or they work on SPEC, and nothing else, etc
<awang> Because real-world code is a mess?
<Fiora> for example, real world code has cosntraints like....
<Fiora> a) you don't know enough about aliasing to conclude some buffer is invariant, even if it is
<Fiora> b) you don't know enough about types to conclude that an object's vtable pointer is invariant, even if it is
<Fiora> c) you don't know enough about callgraphs to conclude a value isn't used, even if it isn't
<Fiora> d) you don't know enough about alignment to conclude that an access is aligned, even if it is
<Fiora> e) you don't know enough about loop variables to conclude that the loop counter is modulo 8, even if it is
<Fiora> f) you don't know enough about range constraints to conclude this expression won't overflow, even if it doesn't
<SnoopJeDi> this is why I feel pretty okay knowing exactly nothing about compilers
<Fiora> etc etc etc
<iximeow> on the other hand i'm sitting here like 'i love compilers so much ;;'
<SnoopJeDi> because afaict real-world compilation is pretty well summed up by "you don't know" and then some Forbidden Invocations of eldritch mathematics to make magick happen anyway
<Fiora> the worst part about all this is that it creates *brittle* optimizations
<Fiora> e.g. if you have some heroic optimization that works in a narrow case
<egg|zzz|egg> Fiora: yeah, so awang's point on (b) is that thanks to placement new, foo->bar(); foo->bar(); may call different bars due to side effects in bar so that's pretty much not an option
<Fiora> one wrong programmer move and it will trigger/not trigger
<Fiora> which makes people go crazy.
<SnoopJeDi> hence all the flags
<Fiora> nah, real-world compilers are mostly just Not Doing that crazy shit.
<iximeow> but jitters!
<iximeow> jitters do all the craziest shit :D
<SnoopJeDi> oh you're still talking about the toy ones
<Fiora> for example, almost all optimizations in LLVM are one of the following things:
<SnoopJeDi> iximeow, I'm fascinated by the compiler world from the outside because it's *all* crazy shit to me
<SnoopJeDi> like the fact that LLVM *exists* is insane
<Fiora> 1) simple, pattern-based transformations of one group of instructions into another
<Fiora> 2) obvious hoisting/sinking/unrolling types of control flow transformations that you could do on a whiteboard
<Fiora> 3) deduplication, elimination of dead stuff, reassociating expressions, and other local optimizations that are, again, conceptually trivial
<SnoopJeDi> Fiora, "simple, but not easy," then?
<iximeow> most of that's fairly easy
<Fiora> 4) turning stack representations into SSA representations
<iximeow> doing it efficiently can be less easy but mostly easy
<SnoopJeDi> iximeow, well, efficiency is kind of the point no?
<Fiora> 5) propagating knowledge throughout the program to apply 1) [e.g. known bits, aliasing]
<Fiora> (SSCP, etc)
<Fiora> *SCCP
<Fiora> that's basically all a compiler does optimization wise
<Fiora> the rest is just transforming between representations.
<Fiora> but yeah most of LLVM's optimizations are not conceptaully hard or complex or anything like that, the challenge is just /programming them/ rather than doing them yourself
<SnoopJeDi> Fiora, I saw a good opinion piece recently lambasting the word "just" and highlighting it as a great flag to pay attention to simplifications :P
<Fiora> SnoopJeDi: i used "just" VERY INTENTIONALLY there
<SnoopJeDi> but yea, I hear what you're saying
<Fiora> since some of the most complex parts of llvm are transforms between representations LOL
<SnoopJeDi> I know you did, I'm poking light fun at it
<SnoopJeDi> LLVM is like
<SnoopJeDi> fuckin duct tape
<SnoopJeDi> AFAICT
<Fiora> ex selectionDAG, which i am attempting to AVOID becoming the maintainer of
<Fiora> at any cost
<Fiora> people have repeatedly tried to goad me into it!!
<iximeow> Fiora: oh i should bug you about SelectionDAG!?
<SnoopJeDi> lmao
<Fiora> yes!! i'm probably the most experienced selectiondag person currently on llvm
<Fiora> (THIS IS SAD)
<Fiora> Justin Bogner knows more about the plumbing of selectionDAG, i know more about combines/etc. not sure who knows most about the Select() infrastructure (not me)
<SnoopJeDi> well thanks for letting me pick your compiler brain for a sec
<SnoopJeDi> maybe real learning One Day™
* egg|zzz|egg somehow didn't know the word goad either
<Fiora> i've probably written at least 10,000 lines of selectiondag combines
<iximeow> Fiora: thankfully(?) i don't get to use llvm much for the time being, but i end up spending spare time looking from time to time :(
<iximeow> one day maybe
<Fiora> thing is, i wouldn't actually say thankfully there. imo, one of llvm's great successes is that its core frameworks work extremely well and it's very easy to just go and write a pass
<SnoopJeDi> egg|zzz|egg, interesting! Although Old English is a spooky place
<Fiora> this is also its downfall, because it's very easy to just go and write a pass, so people write more passes.
<iximeow> most of my time is going assembly -> up, so llvm isn't very applicable without a LOT of hand wringing
<iximeow> ANYWAY
<iximeow> http://chrisseaton.com/rubytruffle/pldi17-truffle/pldi17-truffle.pdf HERE'S A SUPER COOL PAPER ABOUT CRAZY JIT STUFF
* iximeow lunch
<SnoopJeDi> can we just like
<SnoopJeDi> hit the pause button on human knowledge for a bit so I can catch up
<SnoopJeDi> frick
<Fiora> people treat compilers as being way worse than they actually are lol
<Fiora> in terms of knowledge/complexity/"hardness"
<Fiora> almost all the hardness is implementation details, i.e. dealing with the massive codebase of the compiler itself
<icefire> idk, I hear GCC can be nasty
<SnoopJeDi> I feel like I've had a pretty good mental picture since I learned qualitatively about loop unrolling
<Fiora> i have literally never looked up an algorithm in a paper
UmbralRaptop has joined #kspacademia
<Fiora> nor implemented an algorithm that requires more than ~2-4 sentences to describe
<SnoopJeDi> but yea details are for sure the tarpit-y part
<SnoopJeDi> file under: the rest of programming?
<egg|zzz|egg> awang: hmm, is placement new on this actually defined behaviour?
UmbralRaptop has quit [Client Quit]
<Fiora> easy: algorithm to hoist values out of loops. hard: algorithm to UPDATE THE FUCKING LIVEINTERVALS
UmbralRaptop has joined #kspacademia
UmbralRaptor has quit [Read error: Connection reset by peer]
Raptop has joined #kspacademia
<Fiora> basically im saying this because everyone thinks compilers are WAY smarter than they are.
<Fiora> oh right, and 90% of the complexity is in data structures, not algorithms. at least 90%. probably more
<icefire> doesn't sound that much different from other software design
<Fiora> ex: "how do you store an interference graph of register live ranges so it can be easily queried and interferences analyzed, and live ranges split, etc?"
<SnoopJeDi> agreed icefire
<Fiora> If you can implement that data structure and primitive operations, "register allocation" is easy.
Raptop has quit [Read error: Connection reset by peer]
UmbralRaptor has joined #kspacademia
<Fiora> (hence, 90% of register allocation is...... that data structure, basically)
<SnoopJeDi> e.g. how much of scientific computing is "so here are some loops"
<SnoopJeDi> Fiora, it does seem like data structures as a big vague target has come into vogue in broader computing culture
<SnoopJeDi> probably because of algorithms
UmbralRaptop has quit [Ping timeout: 198 seconds]
UmbralRaptop has joined #kspacademia
UmbralRaptop has quit [Client Quit]
UmbralRaptop has joined #kspacademia
UmbralRaptor has quit [Ping timeout: 182 seconds]
* egg|zzz|egg should zzz
<awang> Ah, yes, aliasing
<awang> I'm curious just how much faster assuming no aliasing would make things
<awang> Probably not as much as I hope
<bofh> a lot on certain workloads, this is like 60% of why Fortran compiles to such fast code.
<awang> So compilers are basically applying the easy things on a large scale?
<awang> (sorry, still working through the backlog)
<egg|zzz|egg> bofh: is it just that arguments may not alias, or are there other aliasing restrictions in fortran
<awang> Fiora: It seems I hear either that compilers are stupid and generate horrible horrible code, or they are gods and perform transformations that humans could only dream of
<awang> icefire: Isn't GCC's codebase partially why LLVM was created in the first place?
<icefire> thats what I hear but im not informed on the matter
<awang> egg|zzz|egg: Not really sure
<awang> Someone in #llvm said it's a thing
<awang> Apparently it is
<awang> Orrrr not?
<awang> Dangit stack overflow
<awang> Make up your mind
<SnoopJeDi> awang, false dichotomy? :P
<SnoopJeDi> re: stupid/gods
<kmath> <FioraAeterna> dark secret: at least half the time, the compiler does &lt;X&gt; because nobody wrote any code to make it do something el… https://t.co/x0tleFUrAs
<SnoopJeDi> is there a Razor for that?
<awang> Now that I think about it it probably violates lifetime rules
<egg|zzz|egg> awang: not sure
<awang> Since the lvalue name for the object is no longer valid due to the old object being replaced by the new one
<egg|zzz|egg> SnoopJeDi: we can make it Fiora's I guess?
<awang> SnoopJeDi: We're getting into algorithmnic data structures now
<awang> cache-oblivious containers/algorithms
<awang> bofh: Those "certain workloads" being scienfitic stuff? Curious about more business-y code. Or gaming code.
<awang> SnoopJeDi: That's just what I've seen floating around the net. I know it isn't that clear-cut
<SnoopJeDi> awang, hm? in class, or?
<awang> egg|zzz|egg: That's... depressing, in a way
<awang> "the compiler is dumb because you were too lazy to make it smart"
<egg|zzz|egg> [high latency awang]
<SnoopJeDi> egg|zzz|egg, based on the amount of delicious shade she throws on compilers yes
<awang> SnoopJeDi: Well, more in general. At least my impression is that those have only really been worked on in the last decade or so
<SnoopJeDi> oh no not at all
<awang> egg|zzz|egg: Yes, I need to upgrade my internet
<SnoopJeDi> the most important ones were worked out in like the frickin 60s/70s if not earlier
<awang> And my reading speed
<awang> And typing speed
<SnoopJeDi> i.e. dicts in CPython recently became ordered as a cute side effect of an optimization that Hettinger boiled down to "people thought we were smarter than our predecessors for 40 years and then we realized lol they were pretty smart"
<SnoopJeDi> (paraphrasing heavily there obviously)
<awang> I mean, I guess the focus would change over time
<awang> Since first the CPU's usually the bottleneck
<awang> s/first/at first
<Qboid> awang meant to say: Since at first the CPU's usually the bottleneck
<awang> And now it's memory
<awang> so cache is more important now
<awang> So we're "rediscovering" things
<awang> Or something like that?
<awang> I'm hardly an expert on this
<SnoopJeDi> but pursuant to Fiora's Law, people either A) don't know about those, B) don't care and *want* to re-invent the wheel because shitty entrepreneurship culture or whatever, or probably most common C) don't feel like it and a less optimal approach works Well Enough especially with resource scaling
<SnoopJeDi> see: Electron apps
<SnoopJeDi> see also: Angular/React apps (and hell all MVCs)
<SnoopJeDi> although I guess MVC is kind of at once illustrating that we don't care but also that we do care and it's helped mitigate a TON of hard problems?
<awang> Wasn't Fiora's Law something about how the better the compiler optimization the more likely it broke something?
<awang> Or was that a different tweet?
<awang> lol Electron
<awang> and the infamous "We need 50% of your CPU to render a blinking cursor"
<SnoopJeDi> okay that's fair her statement was compiler-specific
<SnoopJeDi> but I think that might be a special case of a broader fallacy...argument from authority? Invisible programmer hands?
<kmath> <FioraAeterna> a table of my reactions based on how much a new compiler optimization helps: ⏎ ⏎ 0.001%: meh, i give up ⏎ 0.01%: i guess… https://t.co/8ls1GTlA5C
<SnoopJeDi> idk I'm just shuffling Chinese characters from an inbox to an outbox over here man
<awang> egg|zzz|egg: Yep, that was it. Is that Fiora's Law?
<awang> /sit/the tweet
<awang> I should really fix Twitter on my computer at some point
<awang> Twitter loads, instantly redirects to the mobile site, then gets stuck in a redirect loop
UmbralRaptor has joined #kspacademia
<SnoopJeDi> sounds wonderful vs normal Twitter
UmbralRaptop has quit [Ping timeout: 182 seconds]
<SnoopJeDi> just kidding, I like Twitter because I follow people who don't publicly indulge their political misery ALL the time
<awang> I think my only exposure to Twitter is through #kspacademia and NPR
<Fiora> awang: "they are gods and perform transformations that humans could only dream of"
<Fiora> that is an opinion only ever held by people who don't actually work on compilers.
<SnoopJeDi> somewhat tangential, but I like what http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html has to say about this: "If you're not 100% sure whether you know how compilers work, then you don't know how they work."
<Fiora> it's hard enough making CORRECT code :P
<SnoopJeDi> upshot: the 100% is achieveable because of what Fiora is saying about there being a relatively tractable set of problems
<SnoopJeDi> or maybe achieveable* idk I'm definitely not at 100% haha
<awang> egg|zzz|egg: Re: placement new, response on #llvm
<Fiora> nobody is 100% sure
<Fiora> lol
<awang> < awang> Gist of it is that Clang seems to be reloading the vtable pointer every iteration through a loop in that type's member function
<SnoopJeDi> yea he's being AN AMOUNT cheeky there
<awang> < awang> Which doesn't make sense to me, since the vtable for *this shouldn't be changing
<SnoopJeDi> wonder if that guy is still writing Kotlin now that I think of it
<awang> < awang> Unless there's some interesting C++ rules that I'm not aware of?
<awang> < nbjoerg> there was a long discussion about inplace new being able to change that
<awang> < nbjoerg> and what the invalidation rules are
<SnoopJeDi> Fiora, the 100% reminds me of how I struggled with accelerators as a still-wet-behind-the-ears grad student
<awang> And those invalidation rules are for the question "when is the vtable of a pointer allowed to change?"
<SnoopJeDi> turns out we haven't been building institutions with tens of thousands of experts for the hell of it, you actually need those human resources and structures to wrap a collective head around the problem because a single brain literally cannot do it
<awang> Fiora: Which unfortunately is most people
<awang> Programmers should try writing an optimizing compiler to see just what compiler devs are trying to deal with
<SnoopJeDi> I think "peek inside the black box" is pretty good advice in any field
<SnoopJeDi> for some value of peek
<Fiora> i dunno, i've only ever seen it held by overconfident programmer dudes who espouse confident opinions on things they've never worked on
* SnoopJeDi stares at ROOT programs
<SnoopJeDi> Fiora, bro V8 is so good tho
<SnoopJeDi> or V8's compiler I don't know how clear a distinction that is because Javascript is a hellscape anyway
<SnoopJeDi> would be really great if "I don't know" could be a fad
<SnoopJeDi> or more specifically "I don't know and therefore don't think it's reasonable to form a strong opinion yet"
<awang> egg|zzz|egg: Never mind, seems the lifetime rules allow you to placement new(this)?
<awang> ROOT?
<SnoopJeDi> have you ever wanted to write C++ on a REPL because like
<awang> Ah, that
<SnoopJeDi> it's actually a really great framework
<awang> I've used cling from time to time
<awang> Not ROOT
<awang> Yet
<SnoopJeDi> but the accessibility encourages some really really lazy programming
<awang> I AM ROOT
<SnoopJeDi> you mean the CINT interpreter, or ROOT proper?
<awang> Groot?
<SnoopJeDi> ROOT is a bunch of Science Stuff on top of CINT
<awang> Marvel character?
<awang> </bad joke>
<SnoopJeDi> anyway I've just seen so many HEP people who are literally trying every permutation of their code until something sticks
<SnoopJeDi> because they have never bothered to learn...really any C++? Sometimes if it's stupid and it works it's still stupid
<egg|zzz|egg> awang: hm so it seems it's fine, but then foo->kill(); invalidates foo, so the *second* foo->kill() is UB?
<egg|zzz|egg> maybe?
<awang> egg|zzz|egg: The way I'm reading it is that lvalues "automatically update" to point to the newly constructed object?
<awang> The guy's answer seems to contradict the standard quote
<egg|zzz|egg> oh, right
<egg|zzz|egg> what's most derived object again
* egg|zzz|egg looks for 1.8
<awang> I'd guess whatever is furthest down the inheritance chain
<awang> Hmmm
<awang> So basically you can only placement new (this) with the same type?
<awang> Well
<egg|zzz|egg> what?
<awang> It does say "*a* most derived object"
<awang> So I guess they don't have to be the same type
<awang> Er
<awang> I'm not sure how to parse this
<awang> Is it "T, where T is defined as the most derived object"?
<awang> Or "T, a base class from which the most derived object derives"?
<egg|zzz|egg> """If a complete object, a data member (9.2), or an array element is of class type, its type is considered the
<egg|zzz|egg> most derived class, to distinguish it from the class type of any base class subobject; an object of a most
<egg|zzz|egg> derived class type or of a non-class type is called a most derived object.
<awang> Uhhh
<SnoopJeDi> OH, YES, it came to me! I think Fiora's Law is a specific application of Sturgeon's Law
<egg|zzz|egg> awang: so same dynamic type?
<egg|zzz|egg> awang: but what is there besides 8.4
<awang> egg|zzz|egg: I have a feeling that I don't understand "class type" right
* awang goes hunting for the definition of "class type"
<egg|zzz|egg> yeah I think it's the same dynamic type; which means that if you change the type by pawcement mew in a member function, further accesses through the the pointer through which you called that member functions are undefined
<awang> !wpn -add:wpn Mew
<Qboid> awang: Weapon added!
<awang> egg|zzz|egg: Yeah, the standard says "...[a pointer, reference, or name that referred to the old object] can be used to manipulate the new object if... ...the new object is of the same type as the original object (ignoring the top-level cv-qualifiers)
<awang> ...8.2 and 8.4 feel somewhat redundant
<awang> ...Unless std::launder is used
<awang> Hmmm
<egg|zzz|egg> :D
<egg|zzz|egg> yeah but if you call through launder then it's explicit
<awang> Yeah
<awang> Hmmm
<awang> So now I don't know why the vtable pointer has to be reloaded every iteration of the loop again :(
<egg|zzz|egg> yeah the example in cppreference has transmogrify which is exactly this
<egg|zzz|egg> you need to launder in order for the second call not to be UB
<kmath> https://twitter.com/planet4589/status/968976410646925312 <✔planet4589> Bowman et al (Nature 555, 67) - using the EDGES radio telescope https://t.co/xz5KZtZTqJ in Australia - have detect… https://t.co/JnRAZEljx4
<kmath> <FioraAeterna> dark secret: at least half the time, the compiler does &lt;X&gt; because nobody wrote any code to make it do something el… https://t.co/x0tleFUrAs
* egg|zzz|egg pokes bofh with that question about fortran in the backlog
<awang> egg|zzz|egg: I think you linked that already :P
<egg|zzz|egg> yes but it answers your question "why the vtable pointer has to be reloaded every iteration of the loop again" :-p
<awang> Ah
<awang> Fair enough
<awang> I thought there was something preventing it :(
<awang> Also, the example for std::launder is confusing
<awang> Apparently if you placement new (this) with the same type, using a pointer to the old object is UB
<awang> Even though earlier it said that pointers/references/etc. to the old object are redirected
<egg|zzz|egg> has const member
<awang> Oh derp
<awang> I missed the const somehow
<awang> ...Not sure if I want to wade into LLVM to see if I can hoist that vtable pointer load out of the loop
<awang> Or get rid of that load/store
<awang> Fiora: Wait, so are registers always spilled to the stack at the end of their live range?
* awang 🔪 non-constexpr std::sqrt
<awang> So
<awang> Uh
<awang> Does anyone know a closed-form version of this function?
<awang> It feels like it should have one
<awang> But I also feel that I lack the math knowledge to recognize it
<Fiora> spills happen if there's interference from another live range
e_14159 has quit [Ping timeout: 207 seconds]
e_14159 has joined #kspacademia