# GSoC 2025: Profiling and Testing Math Functions on GPUs

DevFeed: [GSoC 2025: Profiling and Testing Math Functions on GPUs](<https://devfeed.tech/articles/gsoc-2025-profiling-and-testing-math-functions-on-gpus-43118.md>)

Original publisher: [Read original article](<https://blog.llvm.org/posts/2025-08-29-gsoc-profiling-and-testing-math-functions-on-gpus/>)

Author: Leandro Augusto Lacerda Campos

Published: 2025-09-01T00:00:00Z

Content type: article

Language: en

Sources: [LLVM Project](<https://devfeed.tech/sources/the-llvm-project-blog.md>)

Topics: [Computing](<https://devfeed.tech/topics/computing.md>), [GPU](<https://devfeed.tech/topics/gpu.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [LLVM](<https://devfeed.tech/topics/llvm.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [OpenCL](<https://devfeed.tech/topics/opencl.md>), [Hardware](<https://devfeed.tech/topics/hardware.md>)

Tags: [2025](<https://devfeed.tech/tags/2025.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [benchmarking](<https://devfeed.tech/tags/benchmarking.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [code](<https://devfeed.tech/tags/code.md>), [computing](<https://devfeed.tech/tags/computing.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [data](<https://devfeed.tech/tags/data.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [gsoc](<https://devfeed.tech/tags/gsoc.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [libc](<https://devfeed.tech/tags/libc.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [library](<https://devfeed.tech/tags/library.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [math](<https://devfeed.tech/tags/math.md>), [opencl](<https://devfeed.tech/tags/opencl.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

This report describes a Google Summer of Code 2025 project that developed a C++ framework for conformance testing of GPU math functions in LLVM-libc and expanded benchmarking infrastructure. It covers standards compliance, accuracy measurement, performance comparisons with vendor libraries, and support for AMD and NVIDIA hardware.

## Source excerpt

With the increasing importance of GPU computing, having a robust and familiar C standard library becomes a valuable asset for developers. The LLVM project is actively working to provide this foundation, as a solid libc implementation enables more complex libraries to be developed for and used on GPUs. A key part of this effort is providing the C standard math library (LLVM-libm) on GPUs, often reusing the same target-agnostic implementations developed for CPU targets. This context creates a twofold challenge. First, there is a need to systematically verify the conformance of these implementations to standards like OpenCL. Second, it is crucial to benchmark their performance against the highly-optimized vendor libraries to understand the trade-offs involved. This Google Summer of Code 2025 project was designed to address both challenges by developing a framework for conformance testing as well as refining and expanding the existing benchmarking infrastructure. The work provides two benefits to the LLVM community: It empowers libc contributors with a robust tool to validate their GPU math function implementations. It builds trust with end-users by providing transparent accuracy and performance data. This report details the work completed on this project. Conformance Testing To address the goal of accuracy verification, I implemented a C++ framework for conformance testing within the offload/unittests/Conformance directory. This framework was designed to be extensible, easy to use, and capable of testing various implementation providers (llvm-libm, cuda-math, hip-math) across different hardware platforms (AMD, NVIDIA). Key Components The framework's power and simplicity come from a few key components that work together: DeviceContext: A lightweight wrapper around the new Offload API that abstracts away the low-level details of device discovery, resource management, and kernel launching. InputGenerator: An extensible interface for test input generation. The framework pr