Skip to main content

VapourSynth-MLRT-MIGX

This package contains the MIGraphX backend implementation of the vs-mlrt plugin.

Installation

pip install vapoursynth-mlrt-migx

Building from source

Only Linux x86-64 is currently supported.

Requirements

  • C++ Compiler: C++20 compatible (e.g. GCC, AMD Clang)
  • Dependencies:
    • migraphx (MIGraphX SDK)
    • hip (ROCm HIP runtime)
  • Environment Variables:
    • ROCM_PATH: Path to ROCm installation (defaults to /opt/rocm if not set)

Compilation

# Set ROCM_PATH if not installed in default /opt/rocm
export ROCM_PATH="/opt/rocm"

uv build --package vapoursynth-mlrt-migx

Detailed parameter information from the parent project follows.


VapourSynth MIGraphX

The vs-migraphx plugin provides optimized HIP runtime for some popular AI filters on AMD GPUs.

Usage

Prototype: core.migx.Model(clip[] clips, string program_path[, int[] overlap, int[] tilesize, int device_id=0, int num_streams=1, string flexible_output_prop=""])

Arguments:

  • clip[] clips: the input clips, only 16/32-bit floating point RGB or GRAY clips are supported. For model specific input requirements, please consult our wiki.

  • string program_path: the path to the prebuilt program (see below)

  • int[] overlap: some networks (e.g. CNN) support arbitrary input shape where other networks might only support fixed input shape and the input clip must be processed in tiles. The overlap argument specifies the overlapping (horizontal and vertical, or both, in pixels) between adjacent tiles to minimize boundary issues. Please refer to network specific docs on the recommended overlapping size.

  • int[] tilesize: Even for CNN where arbitrary input sizes could be supported, sometimes the network does not work well for the entire range of input dimensions, and you have to limit the size of each tile. This parameter specify the tile size (horizontal and vertical, or both, including the overlapping). Please refer to network specific docs on the recommended tile size.

  • int device_id: Specifies the GPU device id to use, default 0. Requires AMD GPUs with gfx1030 target or RDNA3 architecture onwards (list).

  • int num_streams: number of concurrent HIP streams to use. Default 1. Increase if GPU not saturated.

  • string flexible_output_prop: used to support onnx models with arbitrary number of output planes.

    from typing import TypedDict
    
    class Output(TypedDict):
        clip: vs.VideoNode
        num_planes: int
    
    prop = "planes" # arbitrary non-empty string
    output = core.migx.Model(src, program_path, flexible_output_prop=prop) # type: Output
    
    clip = output["clip"]
    num_planes = output["num_planes"]
    
    output_planes = [
        clip.std.PropToClip(prop=f"{prop}{i}")
        for i in range(num_planes)
    ] # type: list[vs.VideoNode]
    

When overlap and tilesize are not specified, the filter will internally try to resize the network to fit the input clips. This might not always work (for example, the network might require the width to be divisible by 8), and the filter will error out in this case.

The general rule is to either:

  1. left out overlap, tilesize at all and just process the input frame in one tile, or
  2. set all three so that the frame is processed in tilesize[0] x tilesize[1] tiles, and adjacent tiles will have an overlap of overlap[0] x overlap[1] pixels on each direction. The overlapped region will be throw out so that only internal output pixels are used.

Instructions

Build program

migraphx-driver compile --onnx drunet_gray.onnx --gpu --input-dim @input 1 2 1080 1920 --output dpir_gray_1080p.mxr

The program can be applied to 1920x1080 input.

Also check migraphx-driver useful arguments

Run model

In vpy script:

# DPIR
src = core.std.BlankClip(src, width=1920, height=1080, format=vs.GRAYS)
sigma = 10.0
flt = core.migx.Model([src, core.std.BlankClip(src, color=sigma/255.0)], engine_path="dpir_gray_1080p.mxr", tilesize=[1920, 1080])

trtexec useful arguments

  • --fp16: Enable fp16 precision, in addition to fp32 (default = disabled)

  • --output <file>: Save the serialized program

  • --migraphx <file>: Load a serialized program

  • --optimize: Performs common graph optimizations

  • --exhaustive-tune: Enables exhaustive search to find the fastest kernel

  • --disable-fast-math: Disable fast math optimization

Also check the full list of options and environment variables.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vapoursynth_mlrt_migx-16.0.tar.gz (673.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vapoursynth_mlrt_migx-16.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (124.2 kB view details)

Uploaded Python 3manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file vapoursynth_mlrt_migx-16.0.tar.gz.

File metadata

  • Download URL: vapoursynth_mlrt_migx-16.0.tar.gz
  • Upload date:
  • Size: 673.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for vapoursynth_mlrt_migx-16.0.tar.gz
Algorithm Hash digest
SHA256 4bde76dab3f92b353332b07eb5d58d4689a8ab58ace6bd85b5666cc8699196fa
MD5 421d8494d120b55e69c62db42cab0046
BLAKE2b-256 5970f5f755a9d607dd5328e6dadcd98a10efde58b9db3a76e86b861662aacd08

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_mlrt_migx-16.0.tar.gz:

Publisher: cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_mlrt_migx-16.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_mlrt_migx-16.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f0282dc8879bdce13203b70ede6381ef6add55651f7a5cad71b586d6c5dea2f
MD5 d0697b23f94e5ef8701078aa8eeeef03
BLAKE2b-256 d31fdc16583b2b7981b6ad3a84711d2478ee8d644c44d9e4458f7d2bb4f8e124

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_mlrt_migx-16.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

16.0 This release

2 files

15.16

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page