Skip to content

Commit

Permalink
Debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Oct 10, 2023
1 parent ca97442 commit 35c4799
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
9 changes: 8 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ version = "0.4.2"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1.6"

[extras]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "InteractiveUtils", "Pkg"]
29 changes: 23 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Test, BFloat16s, Printf, Random
using Test, BFloat16s, Printf, Random, InteractiveUtils

@info "Testing BFloat16s" BFloat16s.llvm_storage BFloat16s.llvm_arithmetic

Expand Down Expand Up @@ -30,11 +30,28 @@ end
end

@testset "abi" begin
f() = BFloat16(1)
@test f() == BFloat16(1)

g(x) = x+BFloat16(1)
@test g(BFloat16(2)) == BFloat16(3)
f() = BFloat16(1f0)
@test f() == BFloat16(1f0)

script = """
using Pkg, BFloat16s
Pkg.activate(; temp=true)
Pkg.add(name="LLVM", rev="tb/bfloat")
using LLVM
ctx = Context()
typ = LLVM.BFloatType()
display(typ)
val = ConstantFP(typ, BFloat16(1.0))
display(val)
"""
run(`$(Base.julia_cmd()) --project=$(Base.active_project()) -e $script`)

@code_llvm f()
@code_native f()

g(x) = x+BFloat16(1f0)
@test g(BFloat16(2f0)) == BFloat16(3f0)
end

@testset "functions" begin
Expand Down

0 comments on commit 35c4799

Please sign in to comment.