Casey Primozic’s Notes

Misc. notes, code, and other content I want to post publicly that don’t warrant a full blog post

By Casey Primozic

Subscribe to RSS

Debugging WebGL GLSL Shader Behavior Differences Between M1 Mac and AMD GPU

The Problem I’ve been working on a shader in GLSL for implementing volumetric fog via raytracing. I did the majority of the work for it it on my M1 Macbook laptop while traveling, but I was eager to try it out on my powerful 7900 XTX when I got home to see how it performed. To my surprise, the results looked extremely different! The lighting was very low-detail on my desktop with the AMD GPU compared to how it looked on my Macbook.
Read more →

Fixing “Could Not Load Openssl” Mastodon Build Error

While trying to update my Mastodon server to the latest v4.2.0 release, I kept running into build failures when running docker-compose build. I got errors like this in the logs: #20 27.04 Bundler 2.4.10 is running, but your lockfile was generated with 2.4.13. Installing Bundler 2.4.13 and restarting using that version. #20 27.21 There was an error installing the locked bundler version (2.4.13), rerun with the `--verbose` flag for more details.
Read more →

Fixing pmndrs Postprocessing Recursive Depth Texture Binding

I’ve been working on building 3D scenes and environments in the browser using Three.JS. As part of those, I make pretty heavy use of the pmndrs postprocessing library for post-processing and effects. I’ve also implemented a custom godrays effect that works with postprocesing called three-good-godrays. It creates a custom pass that is added to the postprocessing EffectComposer which renders volumetric screen-space godrays by reading the depth buffer and shadow map for a light.
Read more →

Fixing “performance is not defined” Issue with Svelte/SvelteKit

The Issue When building my SvelteKit project, I get lots of errors like this in my console: ERROR in ./src/graphEditor/nodes/CustomAudio/MIDIToFrequency/MIDIToFrequencySmallView.svelte Module build failed (from ./node_modules/svelte-loader/index.js): ReferenceError: performance is not defined at now (/home/casey/web-synth/node_modules/svelte/compiler.cjs:7:31) at new Stats (/home/casey/web-synth/node_modules/svelte/compiler.cjs:47:21) at compile (/home/casey/web-synth/node_modules/svelte/compiler.cjs:45535:16) at injectVarsToCode (/home/casey/web-synth/node_modules/svelte-preprocess/dist/transformers/typescript.js:85:45) at mixedImportsTranspiler (/home/casey/web-synth/node_modules/svelte-preprocess/dist/transformers/typescript.js:257:26) at transformer (/home/casey/web-synth/node_modules/svelte-preprocess/dist/transformers/typescript.js:336:11) at transform (/home/casey/web-synth/node_modules/svelte-preprocess/dist/autoProcess.js:46:12) at async /home/casey/web-synth/node_modules/svelte-preprocess/dist/autoProcess.js:117:29 at async script (/home/casey/web-synth/node_modules/svelte-preprocess/dist/autoProcess.js:147:33) at async process_single_tag (/home/casey/web-synth/node_modules/svelte/compiler.cjs:45984:21) at async Promise.all (index 0) at async replace_in_code (/home/casey/web-synth/node_modules/svelte/compiler.
Read more →

Fixing “can’t resolve ‘svelte/internal’” Error After Upgrading svelte

I bumped several of the dependencies for one of my projects. It uses Svelte and Webpack, and makes use of svelte-loader to facilitate importing .svelte files. I upgraded Svelte from v3.57.0 to v4.2.0, and bumped svelte-loader, svelte-preprocess, prettier-plugin-svelte, and many other libraries to their latest versions as well. After the upgrade, my Webpack dev server started up but failed to load with many errors like these displayed in the console:
Read more →

amdgpu_top: A Modern radeontop Alternative

I’ve been using a tool called radeontop for years to monitor the performance and utilization of my AMD GPUs on Linux. It’s a TUI-based application that renders the value of different performance counters as bar charts: For the most part, it does a good job and it provides a concise overview of GPU utilization. However, it seems that radeontop is no longer actively developed/updated. It’s received ~7 commits in the past ~3 years and although it does still mostly work even with the latest GPUs like the 7900 XTX, but it’s not under active development.
Read more →

Generating 4K PBR Textures Using Stable Diffusion XL

I’m picking back up the work that I started last year building 3D scenes and sketches with Three.JS. At that time, it was just after AI image generators like DALL-E and Stable Diffusion were really taking off. I had success running Stable Diffusion locally and using it to generate textures for terrain, buildings, and other environments in the 3D worlds I was building. I was using Stable Diffusion v1 back then.
Read more →

Building RNN Architecture Visualizations With TikZ

I recently finished a big blog post about growing sparse computational graphs with RNNs. An important part of that work involved creating a custom RNN architecture to facilitate the growth of extremely sparse networks. To help explain that custom RNN architecture in the blog post, I created some visualizations that looked like this: These images are SVGs, so they scale infinitely without getting pixelated or blurry. I looked into a few different options for generating these including tools like draw.
Read more →

Stale Queries When Hitting BigQuery Streaming Buffer When Using BI Engine

UPDATE 2023-08-15: Some engineers at Google reached out to me via e-mail after I submitted some feedback about this issue on the GCP console and linked to this blog post. After a few back and forth messages, they were able to diagnose the problem and put out a mitigation that completely fixed it for us! The issue seems to have stemmed from cursors tracking the position in the streaming buffer getting out of sync between the BI engine and base BigQuery.
Read more →

Machine Learning Benchmarks on the 7900 XTX

I recently upgraded to a 7900 XTX GPU. Besides being great for gaming, I wanted to try it out for some machine learning. It’s well known that NVIDIA is the clear leader in AI hardware currently. Most ML frameworks have NVIDIA support via CUDA as their primary (or only) option for acceleration. OpenCL has not been up to the same level in either support or performance. That being said, the 7900 XTX is a very powerful card.
Read more →