<andrewrk>
whew, I think it's all finally sorted out
<andrewrk>
gotta love about linux that you can just copy the home directory and get everything exactly like it was
<shachaf>
Was this battery swelling on the XPS 15?
<andrewrk>
yes
<shachaf>
I have had the same problem on the same computer.
* pixelherodev
notes down to never buy it
<pixelherodev>
Then again, the batteries on my laptop aren't exactly good
<pixelherodev>
They're just... better than dealing with replacing it :P
<leeward>
I like that user-replaceable battery thing.
<pixelherodev>
I love that
<pixelherodev>
It helps with the fact that a lot of the batteries are awful :P
<leeward>
Too bad it's expensive.
<leeward>
I once worked on a product that dropped it as a feature because it saved something like $3 in parts. Gold contacts are pricey.
<pixelherodev>
wowzers
<pixelherodev>
... why are they gold?
<leeward>
It had to handle 13 amp transients.
<pixelherodev>
...ah.
* pixelherodev
pretends to understand because it's easier than forgetting it in two minutes anyways :P
<leeward>
Speakers are like that. Bass is power intensive.
<leeward>
V = IR, and P = IV. 13A at about 3.5V makes for a big drop (and amount of heat) in bad conductors.
<pixelherodev>
gotcha
* pixelherodev
actually does understand
<pixelherodev>
surprisingly enough :P
<leeward>
huzzah
<leeward>
Anyway, soldered in batteries saved millions of dollars.
<pixelherodev>
Ah right
<pixelherodev>
It's on scale
<leeward>
yeah
<pixelherodev>
... frankly, I'd pay $3 more for it to not be soldered
<pixelherodev>
I'd gladly shoulder that cost to avoid soldering it
<pixelherodev>
(sorry)
<leeward>
Given their markup from BOM cost, it would be more in the $15-$30 range.
<pixelherodev>
... why?
<leeward>
On a $200 speaker, that's a differentiator.
<pixelherodev>
Sorry, that just
<pixelherodev>
makes no sense, logically
<pixelherodev>
Crap, line spamming again, sorry
<pixelherodev>
Discord has got me into bad habits
<leeward>
Price is a function of many inputs. One is cost.
<pixelherodev>
Let's say their markup from BOM is Blah
<pixelherodev>
If the only variable changed is user convenience and $3 on the BOM, why bother applying the markup there?
<leeward>
That speaker carried a whole division of the company that was bleeding money while it was being sold.
<pixelherodev>
Heck, just the opposite; wouldn't people be more likely to buy it it was user servicable anyways?
<pixelherodev>
Ah
<leeward>
It was the second iteration of that model, so they had data on how many people actually replaced their batteries. If people have to send it in to be serviced, it actually costs more.
<pixelherodev>
For the company, you mean?
<pixelherodev>
And thus for the consumer?
<leeward>
yes
<pixelherodev>
... so, again: why?
<pixelherodev>
If it's cheaper to just make it user-servicable, why not do so?
<leeward>
The company eats the cost of servicing it, but that $3/unit cost waayy more than their RMA costs.
<pixelherodev>
... again, why not just mark it up by $4 or something? Have a lower markup from BOM?
<pixelherodev>
That seems really, really poorly thought out
<pixelherodev>
Maybe I should stop applying pesky logic to corporations
<leeward>
The markup was driven by the business people. *shrug*
<pixelherodev>
Fire 'em!
<pixelherodev>
They're clearly either incompetent or malicious!
<leeward>
It was actually that company's first really high volume product. Before that, a few hundred thousand units was a huge seller.
<leeward>
So there was an institutional tendency towards high margin products.
<pixelherodev>
Ahh. So the problem was that they were human and inherently flawed? :P
<leeward>
There's also the price thing. $199.95 is a popular number. If a typical consumer (not you;) is looking at a shelf and sees one speaker for $200 and another for $204, they're going to pick the $200 one more than 50% of the time.
<leeward>
There are many problems, but they mostly come down to humans being inherently flawed, yes.
<pixelherodev>
And the educational system, apparently; teach people to know better than that and the companies wouldn't have incentives to treat their customers like idiots
<fengb>
Life would be better without pesky humans
<pixelherodev>
Depends on your definition of life
<leeward>
fengb: Preach it.
<pixelherodev>
And whether you're qualifying which humans to be rid of or declaring all of them as pesky
<fengb>
Psychology is pretty fascinating
<fengb>
Weโre all bags of meat and hormones
<fengb>
Full of irrational dispositions
<pixelherodev>
Don'tcha love thinking about how we're just made up of meat, vampire juice, and tiny bits of minerals, and yet we have the arrogance to think we're better than everything around us?
<leeward>
Well, to be fair, we are pretty awesome.
<pixelherodev>
I disagree; it's more that everything else around us is boring
<pixelherodev>
or, rather, that we don't appreciate what's around us
<fengb>
We taught a rock how to think by shoving in some lightning
<leeward>
Not sure how those statements are different.
<pixelherodev>
We're not *that* much different from, say, a squirrel
<pixelherodev>
The only difference is that we're aware that we're squishy
<leeward>
fengb makes a good point. I don't see any squirrels teaching rocks to think.
<pixelherodev>
Arguably, we're just meat that's been taught to think
<pixelherodev>
plus, we haven't actually taught rocks how to *think* just yet, for any value of think
<pixelherodev>
Calculation != sapience
<leeward>
Details, details.
<andrewrk>
the battery may be a piece of garbage on this laptop but I just compiled LLVM from source in 18 min
<pixelherodev>
lol
<pixelherodev>
that's... honestly impressive
<pixelherodev>
Shouldn't be though
<fengb>
Enjoy the little things
<leeward>
I haven't tried compiling llvm on this machine, because the binary distribution works for me, but it's pretty beefy. Now I'm curious.
<leeward>
The "llvm compiled from source" benchmark
<andrewrk>
pro tip, use `-G Ninja` because it will properly utilize your cores without OOMing when linking
<leeward>
ooh
<leeward>
Can Zig's cmake do that?
<leeward>
Though...I do have 64G on this thing.
<leeward>
apt-get source llvm-10-dev
<andrewrk>
yes
<leeward>
nifty
<leeward>
Heh, ninja fails to build Zig way sooner than make. virtual memory exhausted: Cannot allocate memory
<leeward>
turned off overcommit because oomkiller was taking out my ssh session
<andrewrk>
huh, alrighty then
<leeward>
(this is on an RPi 1B, no surprise it can't build Zig)
<andrewrk>
we'll get there
<leeward>
Yep
frmdstryr has quit [Ping timeout: 272 seconds]
shcv has quit [Remote host closed the connection]
torque has quit [Quit: i am dead]
torque has joined #zig
<leeward>
andrewrk: Your computer is fast. Build time for llvm on my desktop built in 2020: 17m14s (95m58s user)
<leeward>
Interesting. 10 seconds faster with make
ur5us has joined #zig
<pixelherodev>
leeward: could be noise
<leeward>
Yeah, it's a pretty tiny effect.
<leeward>
Still, interesting that the difference is negligible.
<pixelherodev>
Did you specify core utilization manually for them?
<leeward>
for make yes, for ninja no
<pixelherodev>
I wonder what'd happen if you limited ninja to $(nproc) instead of $(nproc+2)
<pixelherodev>
(it defaults to using two jobs more than your physical CPUs)
<pixelherodev>
But please don't testit
<pixelherodev>
test it *
<leeward>
I used n+1 for make. I might test it later, when I'm not using the computer.
<pixelherodev>
Please don't lol
<pixelherodev>
It's not worth wasting the energy for that
<leeward>
Science!
<pixelherodev>
That's a terrible reason
<fengb>
Beats mining bitcoin
<pixelherodev>
So does using AI to determine the best spot to hide a murder victim
<pixelherodev>
Or nearly anything else you can think of
<pixelherodev>
Literally using a computer to plot heinous crimes is less bad than mining bitcoin
<pixelherodev>
That's a really, *really* low bar.
st4ll1 has quit [Ping timeout: 272 seconds]
st4ll1 has joined #zig
xackus has quit [Ping timeout: 264 seconds]
xackus has joined #zig
<leeward>
My level of regret for not buying bitcoins when they were 20 cents is low. It's just...not good for the world.
waleee-cl has quit [Quit: Connection closed for inactivity]
Mulugruntz has joined #zig
craigo has quit [Ping timeout: 256 seconds]
<andrewrk>
I pushed the register allocation branch. I didn't get to a testing checkpoint (or even finish the implementation yet) but the tests are passing and this will prevent merge conflicts
<andrewrk>
pixelherodev, you now have liveness data in your C codegen. for each ir.Inst, you can ask if it or any of its operands die after the instruction
<andrewrk>
see the new methods on ir.Inst
<xackus>
andrewrk: idk if it's still relevant but #5811 passed tidy locally
<andrewrk>
thanks!
<xackus>
i dozed off early yesterday
fraktor has joined #zig
cole-h has quit [Quit: Goodbye]
ur5us has quit [Ping timeout: 244 seconds]
xackus has quit [Ping timeout: 246 seconds]
backwhack has quit [Quit: Connection closed for inactivity]
ur5us has joined #zig
waleee-cl has joined #zig
B4s1l3 has joined #zig
B4s1l3 is now known as opDispatch
<wilsonk>
leeward: you might want to rebuild llvm-10 with clang-10 (I mentioned this to Andrew in the past also. It can be useful if you have to build llvm often). LLVM-10 actually builds about ~6% faster on my machine with clang-10 than with clang-9 (~15% faster than clang-8). And just to show off...llvm-10 with clang, compiler-rt and lld builds in 5 mins 11 seconds here ;) ... that is with a full "link-time-optimization + profile-guided-optimizat
JimRM has quit [Ping timeout: 256 seconds]
utzig has quit [Ping timeout: 260 seconds]
JimRM has joined #zig
utzig has joined #zig
<leeward>
Thanks wilsonk, I'll keep that in mind.
<pixelherodev>
andrewrk: nice!
ur5us has quit [Ping timeout: 256 seconds]
dermetfan has joined #zig
<pixelherodev>
ooh, and CBE cleanup got merged :)
<pixelherodev>
Going to need to update CBE with the new features soon
<andrewrk>
pixelherodev, if you want some inspiration for what to contribute: make an API that abstracts getting the C ABI. basically it gives you an iterator where you tell it a Type, and it returns the next MCValue that is where to store/fetch that parameter
<andrewrk>
this abstraction would be used both for calls, and for getting parameters, and would abstract over the arch
gonz_ has quit [Ping timeout: 272 seconds]
yrashk has quit [Ping timeout: 240 seconds]
yrashk has joined #zig
gonz_ has joined #zig
<pixelherodev>
andrewrk: gladly :)
<pixelherodev>
Might be a few days; I'm a bit busier now
<andrewrk>
same :)
<andrewrk>
for any design questions, here's the guiding principle: write it in such a way that a contributor could glance at the code and understand how to add support for a new arch
<pixelherodev>
Righty
<pixelherodev>
andrewrk: does this mean function params are done in AST -> ZIR?
<andrewrk>
"done" ?
<pixelherodev>
enough for CBE :P
<pixelherodev>
implemented*
<andrewrk>
ahh I see what you're asking. yes
<pixelherodev>
great
<pixelherodev>
that means i can add a test separating exit into a syscall() call ;)
<pixelherodev>
andrewrk: should _ handling be moved to Assignment astGen instead of astGenIdent?
<pixelherodev>
It's only a valid "identifier" for assignments, correct?
<pixelherodev>
Assign generation could probably just special-case it to ignore the lhs
<andrewrk>
it's valid for payload captures too
<andrewrk>
however it may make sense to handle in all those situations explicitly
<andrewrk>
I suggest to leave the compile error in until you're prepared to tackle the problem everywhere
_Vi has joined #zig
ur5us has joined #zig
Patrice_ has joined #zig
frett27_ has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 260 seconds]
craigo has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<forgot-password>
Since when does casting a f64 to f32 via @floatCast cause a compile error? Is this intended?
<forgot-password>
Via @floatCast, by the way
<forgot-password>
Oh, I said that, sorry
<leeward>
Is the number comptime known, and more precise than an f32 can handle?
<forgot-password>
Yes it is comptime known, but the value is 0.001534, which should be perfectly fine for a f32, no?
cole-h has joined #zig
<leeward>
looks like no
<leeward>
@truncate might help you if you don't mind losing precision.
dermetfan has joined #zig
<leeward>
It seems that isn't a number that can be precisely represented with floating point.
<leeward>
0x3f59220ff540895d <- the actual bits of the f64
craigo has quit [Ping timeout: 258 seconds]
Akuli has joined #zig
<forgot-password>
Alright then, thank you. I just do the calculation at runtime now, since it were too many instructions for comptime and I couldn't be bothered to calculate the branch quota
forgot-password has quit [Quit: leaving]
<leeward>
Oh, hey, @truncate doesn't work on floats.
<leeward>
At least, the docs say it doesn't.
<leeward>
Huh, the documentation for @floatCast says it may cause the numeric value to lose precision but using it gives a "loses information" error. I think forgot-password found a bug.
<fengb>
"@floatCast: Convert from one float type to another. This cast is safe, but may cause the numeric value to lose precision."
cole-h has quit [Quit: Goodbye]
<fengb>
Is this documentation wrong and it's throwing an error?
<leeward>
Yep.
<leeward>
There doesn't appear to be any other mechanism for dropping bits from a float, so I think the implementation is wrong and the documentation is right.
fraktor has quit [Ping timeout: 256 seconds]
xackus has joined #zig
dermetfan has quit [Ping timeout: 256 seconds]
<scientes>
it might be that llvm lacks the right intrinsic
<scientes>
lacks support
<scientes>
can you post the error?
ovf has quit [Disconnected by services]
ovf_ has joined #zig
jmiven_ has joined #zig
jzelinskie has quit [*.net *.split]
kushalp has quit [*.net *.split]
fengb has quit [*.net *.split]
ifreund[m] has quit [*.net *.split]
bgiannan has quit [*.net *.split]
Cadey has quit [*.net *.split]
jmiven has quit [*.net *.split]
pmwhite has quit [Read error: Connection reset by peer]
Snektron has quit [Remote host closed the connection]
alva has quit [Remote host closed the connection]
BaroqueLarouche has quit [Remote host closed the connection]
return0e[m] has quit [Read error: Connection reset by peer]
hamoko[m] has quit [Remote host closed the connection]
saskwach has quit [Remote host closed the connection]
leeward has quit [Read error: Connection reset by peer]
leeward has joined #zig
leeward has quit [Remote host closed the connection]
leeward has joined #zig
craigo has joined #zig
dermetfan has joined #zig
stripedpajamas has joined #zig
layneson has quit [Ping timeout: 240 seconds]
layneson has joined #zig
traviss has quit [Quit: Leaving]
<pixelherodev>
I hope to have `_ = blah;` implemented for both ZIR and CBE shortly :)
<pixelherodev>
(with other forms of assign continuing to return a TODO for now)
<pixelherodev>
Whoops. Assertion failure :PP
<xackus>
stage1?
<pixelherodev>
stage2
<pixelherodev>
stage1 already works with it lol
<pixelherodev>
Ah, hm
<pixelherodev>
Should probably just make this fail more gracefully
<pixelherodev>
If two errors occur on a decl (which is an internal error) it currently just `unreachable`s
wilsonk has quit [Ping timeout: 265 seconds]
wilsonk has joined #zig
<pixelherodev>
`Internal error: attempted to override error TODO implement type TypeInfo.Int` That's more useful :)
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
<pixelherodev>
Going to need error tests for CBE
<pixelherodev>
Errors are showing up on the wrong lines
<pixelherodev>
Found the issue though ;)
traviss has joined #zig
<pixelherodev>
`:1:1: error: return type mismatch: expected u8, found comptime_int` pft
<pixelherodev>
Whoa
<pixelherodev>
Semantic analysis is about to cross 20K
<pixelherodev>
Might be worth temporarily putting some pieces behind build_options for faster dev builds
<pixelherodev>
Woot!
<pixelherodev>
Works now!
<pixelherodev>
andrewrk: how does `blah = foo()` show up in Ir?
<pixelherodev>
(analyzed Ir, not ZIR)
layneson has quit [Ping timeout: 256 seconds]
<pixelherodev>
Is that a Constant with a value of the Inst?
<pixelherodev>
Test passes! Woot!
<scientes>
pixelherodev, assign(deref foo)
<scientes>
or rather, pointer to foo()
<pixelherodev>
I don't see assign in Ir
<pixelherodev>
Or ZIR for that matter
riba has joined #zig
<andrewrk>
pixelherodev, in stage2 we don't have variables yet, so you can't do it
<pixelherodev>
Gotcha
<pixelherodev>
Just want to add in "return from noreturn" detection
<pixelherodev>
That'll be more complex analysis though
riba has quit [Ping timeout: 246 seconds]
<pixelherodev>
Shouldn't be too bad, actually
<pixelherodev>
Same as tracking "reached unreachable"
ur5us has joined #zig
kllr_sbstn has joined #zig
xackus has quit [Ping timeout: 240 seconds]
<kllr_sbstn>
Hi! I have a question regarding the new AutoHashMap. I wanted to create a a HashMap with key []u8 and got the error `std.auto_hash.autoHash does not allow slices (here []u8) because the intent is unclear. Consider using std.auto_hash.hash or providing your own hash function instead.` But thing is, std has no member `auto_hash` :-/
<kllr_sbstn>
error: container 'std' has no member called 'auto_hash
<kllr_sbstn>
nevermind, found it `StringHashMap`
Akuli has quit [Quit: Leaving]
shcv has joined #zig
<shcv>
are there any other kinds of iterators that work with for(), or just arrays and slices?
<fengb>
Just arrays and slices
<shakesoda>
just arrays and slices... but you can do some dirty tricks if you want to upset a local compiler dev
<shakesoda>
tricks like @as([*]void, undefined)[0..@intCast(usize, n)];
<fengb>
That only gets you indexes
<shakesoda>
yeah.
<shakesoda>
it's also hideous! but it's a thing you can do, if you really really want.
<pixelherodev>
You're right
<pixelherodev>
I am upset.
<pixelherodev>
:P
<shcv>
yeah; I was wondering how I might give an api compatible with for to a ring buffer
<pixelherodev>
std.fifo
* shakesoda
grumbles about not being able to keep track of all the stuff in std
<fengb>
Hmm, `@as(*[n]void, undefined)` is fewer characters
<shakesoda>
is that equivalent? i swear i tried that
* shakesoda
tries again
<fengb>
I don't know! They all feel gross
<shakesoda>
unable to evaluate constant expression
<shakesoda>
no luck
<shcv>
well, std.fifo is interesting, but I'm pretty sure it's not compatible with for unless you realign it
<fengb>
Oh yeah whoops, n needs to be runtime
<shakesoda>
does std happen to have a thread safe arraylist
<shcv>
I think it might make sense to group all of the collection, data structure, and container types into a 'collection' directory/library; they're just sprinkled with random names throughout std