Skip to content

Instantly share code, notes, and snippets.

View Birch-san's full-sized avatar

Birch-san

View GitHub Profile
@Birch-san
Birch-san / -v.ll
Created July 25, 2020 20:29
5-byte memcpy, 8-byte-aligned goes bang (LLVM IR)
; ModuleID = 'bpftrace'
source_filename = "bpftrace"
target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128"
target triple = "bpf-pc-linux"
%helper_error_t = type <{ i64, i64, i32, i8 }>
; Function Attrs: nounwind
declare i64 @llvm.bpf.pseudo(i64, i64) #0
@Birch-san
Birch-san / gist:e30af4a766283ddee513bf2da264a012
Created February 8, 2022 19:19
Errors incurred cross-compiling Windows SDK headers with llvm-mingw
#69 12.76 In file included from /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/juce_audio_plugin_client_utils.cpp:26:
#69 12.76 /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp:27:11: warning: non-portable path to file '<Windows.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#69 12.76 #include <windows.h>
#69 12.76 ^~~~~~~~~~~
#69 12.76 <Windows.h>
#69 12.77 In file included from /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/juce_audio_plugin_client_utils.cpp:26:
#69 12.77 In file included from /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp:27:
#69 12.77 In file included from /xwin/sdk/include/um/windows.h:171:
#69 12.77 In file included from /xwin/sdk/include/shared/windef.h:24:
#69 12.77 In file included from /xwin/sdk/include/shared/minwindef.h:182:
@Birch-san
Birch-san / gist:d54e6e64be4e954b59a5156f76472a0a
Created February 9, 2022 00:07
Errors compiling Windows SDK
#77 15.92 In file included from /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/juce_audio_plugin_client_utils.cpp:26:
#77 15.92 /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp:27:11: warning: non-portable path to file '<Windows.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#77 15.92 #include <windows.h>
#77 15.92 ^~~~~~~~~~~
#77 15.92 <Windows.h>
#77 15.93 In file included from /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/juce_audio_plugin_client_utils.cpp:26:
#77 15.93 In file included from /linux_native/include/JUCE-6.1.5/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp:27:
#77 15.93 In file included from /xwin/sdk/include/um/windows.h:171:
#77 15.93 In file included from /xwin/sdk/include/shared/windef.h:24:
#77 15.93 In file included from /xwin/sdk/include/shared/minwindef.h:182:
@Birch-san
Birch-san / juce_llvm_14.txt
Created February 13, 2022 18:12
Error compiling JUCE with llvm-mingw 20220209 aka LLVM 14.0.0 RC1
Used:
-DWIN32_LEAN_AND_MEAN (for minimal build)
-D__UIAutomationClient_LIBRARY_DEFINED__ (because juce_win32_ComInterfaces.h has variable names which clash with macro names in mingw's uiautomationclient.h)
And patched mingw header like so:
# rename parameter `new` to `new_`,
# for compatibility with LLVM 14.0.0RC1's Clang
# In file included from /linux_native/include/JUCE-6.1.5/modules/juce_gui_basics/juce_gui_basics.cpp:70:
# In file included from /opt/llvm-mingw/i686-w64-mingw32/include/UIAutomation.h:21:
# /opt/llvm-mingw/i686-w64-mingw32/include/uiautomationcoreapi.h:69:128: error: invalid parameter name: 'new' is a keyword
@Birch-san
Birch-san / gist:a36b10155e51bd814ecc7109501e1e64
Created February 13, 2022 19:34
JUCE 6.1.5 i686 UUIDGetter compile failure
#64 32.16 /opt/llvm-mingw/bin/i686-w64-mingw32-clang++ -DDEBUG=1 -DDONT_SET_USING_JUCE_NAMESPACE=1 -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -DJUCE_MODULE_AVAILABLE_juce_audio_basics=1 -DJUCE_MODULE_AVAILABLE_juce_audio_devices=1 -DJUCE_MODULE_AVAILABLE_juce_audio_formats=1 -DJUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1 -DJUCE_MODULE_AVAILABLE_juce_audio_processors=1 -DJUCE_MODULE_AVAILABLE_juce_audio_utils=1 -DJUCE_MODULE_AVAILABLE_juce_core=1 -DJUCE_MODULE_AVAILABLE_juce_data_structures=1 -DJUCE_MODULE_AVAILABLE_juce_events=1 -DJUCE_MODULE_AVAILABLE_juce_graphics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_basics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_extra=1 -DJUCE_SHARED_CODE=1 -DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone -DJUCE_USE_CURL=0 -DJUCE_VST3_CAN_REPLACE_VST2=1 -DJUCE_WEB_BROWSER=0 -DJucePlugin_AAXCategory=2048 -DJucePlugin_AAXDisableBypass=0 -DJucePlugin_AAXDisableMultiMono=0 -DJucePlugin_AAXIdentifier=com.Birchlabs.JuicySFPlugin -DJucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode -D
@Birch-san
Birch-san / build.out.txt
Created February 13, 2022 23:48
JUCE 6.1.5 compilation failure on llvm-mingw 20220209
[ 25%] Building CXX object CMakeFiles/AudioPluginExample.dir/linux_native/include/JUCE-6.1.5/modules/juce_gui_basics/juce_gui_basics.cpp.obj
/opt/llvm-mingw/bin/x86_64-w64-mingw32-clang++ -DDEBUG=1 -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -DJUCE_MODULE_AVAILABLE_juce_audio_basics=1 -DJUCE_MODULE_AVAILABLE_juce_audio_devices=1 -DJUCE_MODULE_AVAILABLE_juce_audio_formats=1 -DJUCE_MODULE_AVAILABLE_juce_audio_processors=1 -DJUCE_MODULE_AVAILABLE_juce_audio_utils=1 -DJUCE_MODULE_AVAILABLE_juce_core=1 -DJUCE_MODULE_AVAILABLE_juce_data_structures=1 -DJUCE_MODULE_AVAILABLE_juce_events=1 -DJUCE_MODULE_AVAILABLE_juce_graphics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_basics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_extra=1 -DJUCE_SHARED_CODE=1 -DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone -DJUCE_USE_CURL=0 -DJUCE_VST3_CAN_REPLACE_VST2=0 -DJUCE_WEB_BROWSER=0 -DJucePlugin_AAXCategory=0 -DJucePlugin_AAXDisableBypass=0 -DJucePlugin_AAXDisableMultiMono=0 -DJucePlugin_AAXIdentifier=com.yourcompany.AudioPluginExample -DJucePlugi
@Birch-san
Birch-san / build.out.txt
Created February 14, 2022 00:03
JUCE 6.1.5 fails to compile x86 audio plugin via llvm-mingw
[ 25%] Building CXX object CMakeFiles/AudioPluginExample.dir/linux_native/include/JUCE-6.1.5/modules/juce_gui_basics/juce_gui_basics.cpp.obj
/opt/llvm-mingw/bin/i686-w64-mingw32-clang++ -DDEBUG=1 -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -DJUCE_MODULE_AVAILABLE_juce_audio_basics=1 -DJUCE_MODULE_AVAILABLE_juce_audio_devices=1 -DJUCE_MODULE_AVAILABLE_juce_audio_formats=1 -DJUCE_MODULE_AVAILABLE_juce_audio_processors=1 -DJUCE_MODULE_AVAILABLE_juce_audio_utils=1 -DJUCE_MODULE_AVAILABLE_juce_core=1 -DJUCE_MODULE_AVAILABLE_juce_data_structures=1 -DJUCE_MODULE_AVAILABLE_juce_events=1 -DJUCE_MODULE_AVAILABLE_juce_graphics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_basics=1 -DJUCE_MODULE_AVAILABLE_juce_gui_extra=1 -DJUCE_SHARED_CODE=1 -DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone -DJUCE_USE_CURL=0 -DJUCE_VST3_CAN_REPLACE_VST2=0 -DJUCE_WEB_BROWSER=0 -DJucePlugin_AAXCategory=0 -DJucePlugin_AAXDisableBypass=0 -DJucePlugin_AAXDisableMultiMono=0 -DJucePlugin_AAXIdentifier=com.yourcompany.AudioPluginExample -DJucePlugin_
@Birch-san
Birch-san / stack.txt
Created June 6, 2022 22:02
stack trace from attempting to run dalle-playground on M1 GPU with jax/jaxlib 345cc19949273cc414d94e6f13d0620b780af465, iree candidate-20220606.161
Error invoking IREE compiler tool iree-compile
Diagnostics:
/Users/birch/anaconda3/envs/torch-nightly/lib/python3.9/site-packages/transformers/models/bart/modeling_flax_bart.py:926:1: error: failed to legalize operation 'mhlo.scatter' that was explicitly marked illegal
input_ids = input_ids.at[(..., -1)].set(self.config.eos_token_id)
^
compilation failed
Invoked with:
iree-compile /Users/birch/anaconda3/envs/torch-nightly/lib/python3.9/site-packages/iree/compiler/tools/../_mlir_libs/iree-compile - --iree-input-type=mhlo --iree-vm-bytecode-module-output-format=flatbuffer-binary --iree-hal-target-backends=vulkan --iree-mlir-to-vm-bytecode-module --iree-llvm-embedded-linker-path=/Users/birch/anaconda3/envs/torch-nightly/lib/python3.9/site-packages/iree/compiler/tools/../_mlir_libs/iree-lld --mlir-print-debuginfo --mlir-print-op-on-diagnostic=false --iree-llvm-target-triple=arm64-apple-darwin21.5.0 --iree-flow-demote-i64-to-i32 --iree-vulkan-target-triple=m1-moltenvk-macos --iree-llvm-target-cpu-featur
@Birch-san
Birch-san / launch.md
Last active June 6, 2022 22:14
how I encountered error running dalle-playground

VSCode launched dalle-playground's backend/app.py Python process like so:

dalle-playground git:(main) ✗  cd /Users/birch/git/dalle-playground
/usr/bin/env /Users/birch/anaconda3/envs/torch-nightly/bin/python /Users/birch/.vscode/extensions/ms-python.python-2022.6.3/pythonFiles/lib/python/debugpy/launcher 52337 -- /Users/birch/git/dalle-playground/backend/app.py 8080 

Using the following launch.json:

@Birch-san
Birch-san / Downscale algorithms compared.md
Created June 13, 2022 22:56
Round-trip restoration of detail from downsampled images

1400x2000 -> 45x64 -> 180x256

(Downscale via traditional algorithm, upscale via AI)

Upscaling of images via Real-ESRGAN, compared by the algorithm via which they were downscaled:

Bilinear:
image
image