# \#code-generation

**URL:** https://discourse.julialang.org/tag/code-generation/1393.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Why does LLVM like putting floating-point constants into RODATA so much? Is that suboptimal?](https://discourse.julialang.org/t/why-does-llvm-like-putting-floating-point-constants-into-rodata-so-much-is-that-suboptimal/130314)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [June 29, 2025, 8:36pm UTC](https://discourse.julialang.org/t/why-does-llvm-like-putting-floating-point-constants-into-rodata-so-much-is-that-suboptimal/130314 "2025-06-29T20:36:46Z")

</div>

It is almost impossible to avoid LLVM storing operands in floating-point operations into the data segment, RODATA, of the executable. For example, here the compiler converts 3 into Float64, storing the bytes into the da…

---

## [CUDA(.jl) memory errors for very large kernels](https://discourse.julialang.org/t/cuda-jl-memory-errors-for-very-large-kernels/125831)

<div class="topic-metadata">

**Author:** [@AntonReinhard](https://discourse.julialang.org/u/AntonReinhard)\
**Replies:** 24\
**Last updated:** [April 22, 2025, 6:45pm UTC](https://discourse.julialang.org/t/cuda-jl-memory-errors-for-very-large-kernels/125831 "2025-04-22T18:45:39Z")

</div>

I have some questions about what some CUDA errors mean and what I can do about them. I’m dynamically generating code that I can successfully compile for both CPU and GPU targets (the GPU I’m using here is an A30 with 24…

---

## [Julia code and struct generation](https://discourse.julialang.org/t/julia-code-and-struct-generation/119044)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 12\
**Last updated:** [September 6, 2024, 12:32pm UTC](https://discourse.julialang.org/t/julia-code-and-struct-generation/119044 "2024-09-06T12:32:56Z")

</div>

I would like to generate a bunch of types for each possible file data format. There is a header with a nibble, X, that determines which fields are present. struct A\_X \<: B # X == 0x0 .. 0xF vall:…

---

## [How to code-gen unrolled loop over a tuple?](https://discourse.julialang.org/t/how-to-code-gen-unrolled-loop-over-a-tuple/117655)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 28\
**Last updated:** [August 9, 2024, 8:58pm UTC](https://discourse.julialang.org/t/how-to-code-gen-unrolled-loop-over-a-tuple/117655 "2024-08-09T20:58:52Z")

</div>

I would like a function that accepts a tuple of functions, picks one at random based on provided relative weights, and passes it to a definite second function. Right now, I accomplish this as follows, for e.g. a tuple of…

---

## [Code Generation with macro](https://discourse.julialang.org/t/code-generation-with-macro/117080)

<div class="topic-metadata">

**Author:** [@Andy\_Zhang](https://discourse.julialang.org/u/Andy_Zhang)\
**Replies:** 6\
**Last updated:** [July 22, 2024, 12:58pm UTC](https://discourse.julialang.org/t/code-generation-with-macro/117080 "2024-07-22T12:58:38Z")

</div>

Background I am writing a package that provides some structures of matrices, and I want them to have different properties. module MyModuleA export TypeA, properties # function interfaces properties(::Type{\<:Ab…

---

## [Update source file with eval-resulted code](https://discourse.julialang.org/t/update-source-file-with-eval-resulted-code/101636)

<div class="topic-metadata">

**Author:** [@algunion](https://discourse.julialang.org/u/algunion)\
**Replies:** 3\
**Last updated:** [July 15, 2023, 10:33am UTC](https://discourse.julialang.org/t/update-source-file-with-eval-resulted-code/101636 "2023-07-15T10:33:19Z")

</div>

Imagine the following scenario: I have a function that generates an Expr, which is in turn processed by eval. To make it easier, let’s create a small example: function makeval() ex = Expr(:function, …
