Skip to content

Instantly share code, notes, and snippets.

View certik's full-sized avatar

Ondřej Čertík certik

View GitHub Profile
@certik
certik / README.md
Created November 25, 2026 02:59
fplotlib report_t + Markdown tables demo

fplotlib HPC report demo preview

@certik
certik / README.md
Last active November 25, 2026 18:46
fplotlib PR #115 gallery previews

PR #115 rendered gallery previews

@certik
certik / README.md
Created November 24, 2026 02:20
Comparison images for fortran-lang/fplotlib#104
! Style parsing and color/marker/linestyle helpers for fplot.
module fplot_style
implicit none
private
integer, parameter, public :: dp = kind(0.0d0)
integer, parameter, public :: MARKER_NONE = 0
integer, parameter, public :: MARKER_CIRCLE = 1
integer, parameter, public :: MARKER_X = 2
import altair as alt
import numpy as np
import pandas as pd
# Create the same data as p2-mpl.py
x1 = np.linspace(0.0, 5.0)
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
x2 = np.linspace(0.0, 2.0)
y2 = np.cos(2 * np.pi * x2)
@certik
certik / SKILL.md
Created March 31, 2026 01:06
fix-leak
name fix-leak
description Fix a memory leak flagged by NO_DETECT_LEAK in an LFortran integration test. Investigates whether the leak is a user-level Fortran pointer leak or a compiler-generated leak from an ASR pass. For user leaks, appends a USER_LEAK comment. For compiler leaks, fixes the source and removes the NO_DETECT_LEAK label. Triggers: fix leak, memory leak, NO_DETECT_LEAK, detect leak, leak, USER_LEAK, compiler leak.

Design: Explicit Self Argument in Call Args

Problem Statement

In the current LFortran ASR, type-bound procedure calls with PASS semantics store the self/pass argument separately from the explicit call arguments:

SubroutineCall(name, original_name, args, dt, strict_bounds_checking)
FunctionCall(name, original_name, args, type, value, dt)

Switching to Byte-Based Strides in LFortran's Array Descriptor

Background

LFortran's internal array descriptor is designed to be compatible with CFI_cdesc_t (the ISO_Fortran_binding descriptor), but it currently stores strides in element units rather than byte units. This mismatch requires conversion at every bind(c) boundary.

This document summarizes why switching to byte-based strides is the right move.

Plan: Align LFortran Descriptor with Fortran Standard / Flang

Problem

LFortran's array descriptor (CFI_cdesc_t) diverges from the Fortran standard and from both GFortran and Flang in several ways. This causes ABI incompatibility with any C code compiled against a standard-compliant ISO_Fortran_binding.h.

Current LFortran descriptor (48 + rank×24 bytes):

@certik
certik / plan.md
Created March 12, 2026 23:11
LFortran Quadruple Precision Plan

Plan for Implementing Quadruple Precision (REAL(KIND=16)) in LFortran

Overview

LFortran will support full IEEE 754 binary128 quadruple precision (REAL(KIND=16) and COMPLEX(KIND=16)) using LLVM’s native fp128 type for all arithmetic and most operations. This provides exact binary128 semantics (15-bit exponent, 113-bit mantissa) on every target LLVM supports.

Transcendental intrinsics will be provided through an optional, thin runtime wrapper that can link to libquadmath (or the platform’s _Float128 / long-double functions when available). Basic operations, array intrinsics, and most language features will work with zero extra dependencies.

The implementation is designed to be incremental, portable, and consistent with existing LFortran infrastructure (ASR → LLVM IR lowering, runtime library, multiple backends, JIT).