Skip to content

Keluaa/CodeDiffs.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeDiffs

Stable Dev Build Status Coverage Aqua

Compare code and display the difference in the terminal side-by-side, based on DeepDiffs.jl. Supports syntax highlighting.

The @code_diff macro is the main entry point. If possible, the code type will be detected automatically, otherwise add e.g. type=:native for native assembly comparison:

Syntax highlighting for Julia AST is also supported:

The @code_for macro is a convinence macro which will give you only one side of @code_diff's output, therefore it behaves like all @code_native/@code_** macros but with seamless support for GPU and additional cleanup functionalities.

Supported languages

  • :native native CPU assembly (output of @code_native)
  • :llvm native LLVM IR (output of @code_llvm)
  • :typed Typed Julia IR (output of @code_typed)
  • :ast Julia AST (any Expr, relies on Revise.jl)

Their equivalents for each GPU package is also supported:

Code type CUDA.jl AMDGPU.jl oneAPI.jl Metal.jl
Julia Typed :cuda_typed :rocm_typed :one_typed :mtl_typed
LLVM IR :cuda_llvm :rocm_llvm :one_llvm :mtl_llvm
Native :cuda_native/:ptx :rocm_native/:gcn :one_native/:spirv :mtl_native/:agx

Additionally, SASS assembly from CUDA is also supported with :sass.

Each output should match the output @device_code_typed, @device_code_llvm and @device_code_native defined by their respective GPU package, as well as accepting the same options.

Calls to kernels from KernelAbstractions.jl will give the code of the actual underlying kernel seamlessly.