Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Edd Barrett vext01

🏠
Working from home
View GitHub Profile
@vext01
vext01 / text.txt
Last active Sep 22, 2021
Blocking Optimsations
View text.txt
TODO: convert to markdown.
Consider the scenario where we want to benchmark some code:
```
start_time = time();
bench_output = run_bench(bench_inputs);
result = time() - start_time;
```
View audio1.txt
uaudio0 at uhub4 port 4 configuration 1 interface 1 "SteelSeries SteelSeries Arctis 1 Wireless" rev 1.10/1.05 addr 6
uaudio0: class v1, full-speed, sync, channels: 2 play, 1 rec, 4 ctls
audio1 at uaudio0
name=uaudio0
mode=
pause=1
active=0
nblks=16
@vext01
vext01 / error.txt
Created Aug 27, 2021
Linkage error adding a new pass
View error.txt
usr/bin/ld: ../../../../lib/libLLVMPasses.a(PassBuilder.cpp.o): in function `llvm::detail::PassModel<llvm::Function, llvm::YkTraceInputsPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)':
PassBuilder.cpp:(.text._ZN4llvm6detail9PassModelINS_8FunctionENS_17YkTraceInputsPassENS_17PreservedAnalysesENS_15AnalysisManagerIS2_JEEEJEE3runERS2_RS6_[_ZN4llvm6detail9PassModelINS_8FunctionENS_17YkTraceInputsPassENS_17PreservedAnalysesENS_15AnalysisManagerIS2_JEEEJEE3runERS2_RS6_]+0xa): undefined reference to `llvm::YkTraceInputsPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)'
collect2: error: ld returned 1 exit status
View dump.txt
1 --- Begin trace dump for __yk_compiled_trace_0 --- │ 1 --- Begin trace dump for __yk_compiled_trace_0 ---
2 Trace | AOT │ 2 Trace | AOT
3 # main() │ 3 %2 = alloca i8*, align 8
4 %2 = alloca i8*, align 8 | %7 = alloca i8*, align 8 │ 4 # main()
5 store i8* null, i8** %2, align 8 | store i8* %14, i8** %7, align 8 │ 5 store i8* null, i8** %2, align 8 | store i8* %14, i8** %7, align 8
6 %3 = alloca i32, align 4 │ 6 # f()
7
View crash.md
doas egdb sndiod -d -f rsnd/3

Remove device while something is playing:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x0000056f09b6d1c0 in dev_abort (d=0x571c83b7000) at dev.c:1276
1276                    if (c->opt->dev != d)
@vext01
vext01 / crash.md
Created Jan 29, 2021
sndiod crash
View crash.md
uaudio2 at uhub8 port 4 configuration 1 interface 1 "SteelSeries SteelSeries Arctis 1 Wireless" rev 1.10/1.05 addr 7
uaudio2: class v1, full-speed, sync, channels: 2 play, 1 rec, 4 ctls
audio3 at uaudio2
$ doas egdb --args ./sndiod -d -f rsnd/3
...
(gdb) run
@vext01
vext01 / bt
Created Jan 24, 2021
sndiod crash
View bt
(gdb) bt
#0 kill () at /tmp/-:3
#1 0x00000601226f396a in panic () at utils.c:138
#2 0x00000601226e57ed in slot_detach (s=0x601226f8990 <slot_array>) at dev.c:2278
#3 0x00000601226e37c1 in slot_setopt (s=0x601226f8990 <slot_array>,
o=0x603f26e6d00) at dev.c:2095
#4 0x00000601226ed2bf in opt_setdev (o=0x603f26e6d00, d=<optimized out>)
at opt.c:236
#5 0x00000601226e2024 in ctl_setval (c=0x603af476100, val=1) at dev.c:2667
#6 0x00000601226f1dac in sock_execmsg (f=0x6033f44dc00) at sock.c:1326
View 1 Problem description.md

Trying to use this use DAC on OpenBSD-6.8 and -current fails.

uaudio2 at uhub0 port 1 configuration 1 interface 3 "E+ Corp. DAC Audio" rev 1.10/0.01 addr 2
uaudio2: class v1, full-speed, async, channels: 2 play, 0 rec, 3 ctls
audio3 at uaudio2

The problem is that one of the checks fails when trying to get a usb interface handle:

View profiling.txt
Costs > 1%.
Before:
```
Overhead Command Shared Object Symbol
9.51% mt::tests::simp ykrt-589c0db448b16d4d [.] core::sync::atomic::atomic_compare_exchange
8.78% mt::tests::simp ykrt-589c0db448b16d4d [.] core::intrinsics::is_aligned_and_not_null
7.89% mt::tests::simp ykrt-589c0db448b16d4d [.] core::option::Option<T>::as_ref
3.52% mt::tests::simp ykrt-589c0db448b16d4d [.] core::intrinsics::is_aligned_and_not_null
3.44% mt::tests::simp ykrt-589c0db448b16d4d [.] core::num::<impl usize>::checked_mul
View gist:cc538135175d232bf0b03297bbd29258
let a = ...
let b = ...
if ... {
let z = a
} else {
let z = b
}