Skip to content

Instantly share code, notes, and snippets.

@juniorprincewang
juniorprincewang / amd-urls.txt
Last active April 25, 2021 03:36 — forked from yurikoles/amd-urls.txt
AMD GPU Open Source development docs
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/AMD_HDA_verbs_v2.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/CIK_3D_registers_v2.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/si_programming_guide_v2.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/SI_3D_registers.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/evergreen_cayman_programming_guide.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/evergreen_3D_registers_v2.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/cayman_3D_registers_v2.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/R6xx_R7xx_3D.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/10/R6xx_3D_Registers.pdf
http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/r600isa.pdf
@juniorprincewang
juniorprincewang / hosts
Created June 22, 2020 09:03
github 加速访问
# GitHub520 Host Start
185.199.108.154 github.githubassets.com
199.232.68.133 camo.githubusercontent.com
199.232.68.133 github.map.fastly.net
199.232.69.194 github.global.ssl.fastly.net
140.82.114.3 github.com
140.82.112.5 api.github.com
199.232.68.133 raw.githubusercontent.com
199.232.68.133 user-images.githubusercontent.com
199.232.68.133 favicons.githubusercontent.com
[43271.071796] nouveau 0000:02:00.0: mmu: subdev init running...
[43271.071798] nouveau 0000:02:00.0: mmu: one-time init running...
[43271.071800] nouveau 0000:02:00.0: mmu: one-time init completed in 1us
[43271.071801] nouveau 0000:02:00.0: mmu: init running...
[43271.071803] nouveau 0000:02:00.0: mmu: subdev init completed in 5us
[43271.071807] nouveau 0000:02:00.0: imem: new 00001000 00000000 0: 007fd75000 0000001000
[43271.071811] nouveau 0000:02:00.0: mmu: bar2: func nvkm_vmm_ctor pd_header 0x0 addr 0x0 size 0x2000000 name bar2
[43271.071813] nouveau 0000:02:00.0: mmu: bar2: bits 40 levels 2
[920826.330878] nouveau 0000:02:00.0: mmu: grctx: func nvkm_vmm_map_locked addr 0x0 size 0xad000 page 7 refd 7
[920826.330878]
[920826.330879] nouveau 0000:02:00.0: mmu: grctx: trying 17
[920826.330881] nouveau 0000:02:00.0: mmu: grctx: alignment 0000000000000000 00000000000ad000 0000000000000000 17 12
[920826.330882] nouveau 0000:02:00.0: mmu: grctx: trying 12
[920826.330885] nouveau 0000:02:00.0: mmu: grctx: func gf100_vmm_valid
[920826.330885]
[920826.330886] nouveau 0000:02:00.0: mmu: grctx: func nvkm_vmm_iter name ref + map page->shift 12 addr 0x0 size 0xad000
[920826.330886]
[920826.330889] nouveau 0000:02:00.0: mmu: grctx: 00000:00000: ref + map: 0000000000000000 00000000000ad000 shift 12 173 PTEs lvl max 1
@juniorprincewang
juniorprincewang / nouveau_object_new.log
Last active June 10, 2020 05:49
create oclass=0xa0c0 (KEPLER_COMPUTE_A) object
nouveau 0000:02:00.0: DRM: func nouveau_abi16_ioctl_grobj_alloc, chan id 2
nouveau: DRM-master:00000000:00000000: ioctl: size 32
nouveau: DRM-master:00000000:00000000: ioctl: vers 0 type 01 object ffff8f3c83489510 owner ff
nouveau: user_test[21217]:00000000:0000a06f: ioctl: sclass size 8
nouveau: user_test[21217]:00000000:0000a06f: ioctl: sclass vers 0 count 0
nouveau: user_test[21217]:00000000:0000a06f: func nvkm_fifo_chan_child_get mask 0x2000404000000
nouveau: user_test[21217]:00000000:0000a06f: func nvkm_fifo_chan_child_get mask 0x2000404000000
nouveau: user_test[21217]:00000000:0000a06f: func nvkm_fifo_chan_child_get mask 0x2000404000000
nouveau: user_test[21217]:00000000:0000a06f: func nvkm_fifo_chan_child_get mask 0x2000404000000
nouveau: user_test[21217]:00000000:0000a06f: func nvkm_fifo_chan_child_get mask 0x2000404000000
@juniorprincewang
juniorprincewang / LICENSE
Created May 19, 2020 09:02 — forked from domnikl/LICENSE
C function to dump memory
Copyright 2018 Dominik Liebler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O
@juniorprincewang
juniorprincewang / test_cudaLaunchKernel.cu
Last active October 10, 2022 13:38
cudaLaunchKernel usage
// Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
//
// This work is made available under the Nvidia Source Code License-NC.
// To view a copy of this license, visit
// https://nvlabs.github.io/stylegan2/license.html
// From https://github.com/NVlabs/stylegan2/blob/master/test_nvcc.cu
#include <cstdio>
void checkCudaError(cudaError_t err)
@juniorprincewang
juniorprincewang / vm_insert_page.c
Last active April 24, 2020 12:42
vm_insert_page
int _mmap(struct file *f, struct vm_area_struct *vma) {
unsigned long pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
unsigned long addr;
struct page *page;
int i,rc=-ENODEV;
// TODO need any semaphore for vma manipulation?
printk(KERN_DEBUG "vma->vm_end %lu vm_start %lu len %lu pages %lu vm_pgoff %lu\n",
vma->vm_end, vma->vm_start, vma->vm_end - vma->vm_start, pages, vma->vm_pgoff);
/* allocate and insert pages to fill the vma. */
for(i=0; i < pages; i++) {
@juniorprincewang
juniorprincewang / awesome.patch
Created April 16, 2020 01:56 — forked from 17twenty/awesome.patch
Really simple example of using get_user_pages and memory aligned allocation using posix_memalign. Hope this helps!
diff -PurN dummy/gu_page.c get_user_pages/gu_page.c
--- dummy/gu_page.c 1970-01-01 01:00:00.000000000 +0100
+++ get_user_pages/gu_page.c 2012-06-14 14:41:31.797310260 +0100
@@ -0,0 +1,124 @@
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+
@juniorprincewang
juniorprincewang / cuda_version.sh
Created April 5, 2020 10:33
Get cuda version
#!/bin/bash
version="$(cat /usr/local/cuda/version.txt | head -n1|cut -d " " -f3)"
echo $version
majorminor=${version%.*}
echo $majorminor