Skip to content

Commit a86bfd7

Browse files
Matthäus G. ChajdasMatthäus G. Chajdas
authored andcommitted
RDF 1.0
1 parent 4de38f7 commit a86bfd7

40 files changed

+88419
-2
lines changed

.clang-format

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
BasedOnStyle: Google
2+
ColumnLimit: 100
3+
IndentWidth: 4
4+
AlignAfterOpenBracket: Align
5+
BreakBeforeBraces: Custom
6+
BraceWrapping:
7+
AfterCaseLabel: false
8+
AfterUnion: true
9+
AfterEnum: true
10+
AfterStruct: true
11+
SplitEmptyFunction: true
12+
AfterNamespace: true
13+
AfterClass: true
14+
AfterFunction: true
15+
AfterControlStatement: MultiLine
16+
BeforeElse : false
17+
AllowShortIfStatementsOnASingleLine: false
18+
IndentCaseLabels: false
19+
DerivePointerAlignment: false
20+
PointerAlignment: Left
21+
AlignTrailingComments: true
22+
AllowShortBlocksOnASingleLine: false
23+
AlignConsecutiveDeclarations: false
24+
AlignConsecutiveAssignments: false
25+
AlignOperands: true
26+
AllowAllParametersOfDeclarationOnNextLine: false
27+
AllowAllArgumentsOnNextLine: true
28+
AllowShortCaseLabelsOnASingleLine: false
29+
BinPackArguments: false
30+
BinPackParameters: false
31+
AccessModifierOffset: -4
32+
ReflowComments: false
33+
SortIncludes: false
34+
TabWidth: 4
35+
UseTab: Never
36+
NamespaceIndentation: Inner

CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
2+
cmake_minimum_required(VERSION 3.13..3.21)
3+
project(rdf LANGUAGES CXX)
4+
5+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
6+
set(RDF_IS_TOP_LEVEL ON)
7+
else()
8+
set(RDF_IS_TOP_LEVEL OFF)
9+
endif()
10+
11+
option(RDF_BUILD_TESTS "Build the tests" ${RDF_IS_TOP_LEVEL})
12+
option(RDF_BUILD_TOOLS "Build RDF tools" ${RDF_IS_TOP_LEVEL})
13+
option(RDF_BUILD_INSTALL "Install RDF libs" ${RDF_IS_TOP_LEVEL})
14+
option(RDF_ENABLE_CXX_BINDINGS "Allow usage of C++ interface for RDF library" ON)
15+
option(RDF_STATIC "Build RDF as a static library" OFF)
16+
17+
if(RDF_BUILD_TESTS)
18+
enable_testing()
19+
endif()
20+
21+
# Set the C++ standard for all libraries/executables in RDF
22+
set(CMAKE_CXX_STANDARD 11)
23+
set(CMAKE_CXX_STANDARD_REQUIRED True)
24+
set(CMAKE_CXX_EXTENSIONS OFF)
25+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
26+
27+
# Don't modify these variables for projects that consume this libary using add_subdirectory
28+
if (RDF_IS_TOP_LEVEL)
29+
set(CMAKE_SKIP_BUILD_RPATH FALSE)
30+
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
31+
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
32+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
33+
34+
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
35+
if("${isSystemDir}" STREQUAL "-1")
36+
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
37+
endif()
38+
39+
set(CMAKE_EXECUTABLE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
40+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
41+
endif()
42+
43+
add_subdirectory(imported)
44+
add_subdirectory(rdf)
45+
if(RDF_BUILD_TOOLS)
46+
add_subdirectory(rdfi)
47+
add_subdirectory(rdfg)
48+
add_subdirectory(rdfm)
49+
endif()

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Advanced Micro Devices, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
1-
# rdf-public
2-
Public-facing, open-source capable RDF repository.
1+
# RDF
2+
3+
Radeon data file library. Check the [specification](docs/specification.md) for details about the file format.
4+
5+
This repository contains the main library (`amdrdf`) as well as a few useful binaries:
6+
7+
* `rdfm` merges two files together (assuming they contain disjoint data)
8+
* `rdfi` dumps information about a file (what chunks it contains, etc.)
9+
* `rdfg` generates a chunk file from a JSON description (useful for testing)
10+
11+
## Overview
12+
13+
RDF files consist of named chunks. You can think of a file as a list of chunks that you can index using a name. File formats are built on top of RDF by defining chunk names and chunk contents. If you need a new file format, all you need to agree on is a unique set of chunk names and you're good to go. Chunks can be optionally compressed and versioned, which removes the need for versioning whole files.
14+
15+
The same chunk can appear multiple times in a file. They'll get enumerated so it's perfectly fine to have a `Mesh` chunk for each mesh and simply add as often as needed. The full chunk identifier is the chunk name and the index. Chunks are always consecutively numbered in a file.
16+
17+
A chunk consists of a header and the data. The difference between those is that the header is always uncompressed and meant to contain only very little data (they might get all loaded in memory for instance). The data part can be optionally compressed.
18+
19+
There is a C and a C++ API. The C API is the "low level" API that is exported from the DLL/shared object. RDF also comes with a C++ wrapper that uses the C API to simplify usage.
20+
21+
Chunk files are assumed to be immutable, so the code is split into a `ChunkFile` class which represents the (immutable) file, and a `ChunkFileWriter` which can be used to create a new file. Additionally, RDF exposes a stream abstraction to allow reading/writing from disk, memory, or other sources.
22+
23+
## Versioning
24+
25+
The `amdrdf` library provides the following forwards/backwards compatibility guarantees:
26+
27+
* For the same major version, any minor version will only *add* new entry points and enumeration values, but existing entry points will not change. Using a higher minor version is always safe. Files created by a newer library *may* not be compatible with older files if new features are used. For example, a new compression codec could be added as part of a minor API change as this is an extension only. However, as long as no new feature is used, all files produced by a newer minor version will remain compatible with older minor versions.
28+
* New major versions *may* add, remove or change entry points. Files created by a newer major version *may* not be compatible with older *major* versions. Files created by an older major version will be supported for *at least* the next higher major version.
29+
* A minor version can deprecate a function, but that function can be only removed in the next major release.
30+
31+
Use `RDF_INTERFACE_VERSION` and `RDF_MAKE_VERSION` to check for the library version.

docs/rdf.ksy

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
meta:
2+
id: rdf
3+
title: Radeon Data File
4+
file-extension: rdf
5+
endian: le
6+
seq:
7+
- id: header
8+
type: header
9+
types:
10+
header:
11+
seq:
12+
- id: identifier
13+
# This is 8 characters long, hence the trailing space
14+
# Earlier versions used RTA_DATA which used all 8
15+
# characters (and it also allows reading directly into
16+
# an UINT64)
17+
contents: "AMD_RDF "
18+
- id: version
19+
type: u4
20+
- id: reserved
21+
type: u4
22+
- id: index_offset
23+
type: s8
24+
- id: index_size
25+
type: s8
26+
instances:
27+
index:
28+
pos: index_offset
29+
size: index_size
30+
type: index
31+
index:
32+
seq:
33+
- id: entries
34+
type: index_entry
35+
repeat: eos
36+
index_entry:
37+
seq:
38+
- id: identifier
39+
type: str
40+
size: 16
41+
terminator: 0
42+
encoding: UTF-8
43+
- id: compression
44+
type: u1
45+
enum: compression
46+
- id: reserved
47+
size: 3
48+
- id: version
49+
type: u4
50+
- id: chunk_header_offset
51+
type: s8
52+
- id: chunk_header_size
53+
type: s8
54+
- id: chunk_data_offset
55+
type: s8
56+
- id: chunk_data_size
57+
type: s8
58+
- id: uncompressed_chunk_size
59+
type: s8
60+
instances:
61+
header:
62+
io: _root._io
63+
pos: chunk_header_offset
64+
size: chunk_header_size
65+
data:
66+
io: _root._io
67+
pos: chunk_data_offset
68+
size: chunk_data_size
69+
enums:
70+
compression:
71+
0: none
72+
1: zstd

0 commit comments

Comments
 (0)