From f32c2fb0332c0e20821c9b6be17576a977c35402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Thu, 25 Aug 2022 09:13:15 +0200 Subject: [PATCH] RDF 1.1 --- CMakeLists.txt | 2 +- README.md | 10 +++++++++- imported/CMakeLists.txt | 2 +- imported/catch2/CMakeLists.txt | 2 +- imported/cli11/CMakeLists.txt | 2 +- imported/json/CMakeLists.txt | 2 +- imported/zstd/CMakeLists.txt | 2 +- rdf/CMakeLists.txt | 2 +- rdf/inc/amdrdf.h | 22 ++++++++++++++++++++-- rdf/src/amdrdf.cpp | 10 ++++++++-- rdf/test/CMakeLists.txt | 2 +- rdf/test/src/IO_test.cpp | 2 +- rdf/test/src/main.cpp | 2 +- rdfg/CMakeLists.txt | 2 +- rdfg/src/rdfg.cpp | 2 +- rdfi/CMakeLists.txt | 2 +- rdfi/src/rdfi.cpp | 2 +- rdfm/CMakeLists.txt | 2 +- rdfm/src/rdfm.cpp | 2 +- 19 files changed, 53 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a3dfdb..148b9ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### cmake_minimum_required(VERSION 3.13..3.21) project(rdf LANGUAGES CXX) diff --git a/README.md b/README.md index fba01f3..d7fd338 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,12 @@ The `amdrdf` library provides the following forwards/backwards compatibility gua * 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. * A minor version can deprecate a function, but that function can be only removed in the next major release. -Use `RDF_INTERFACE_VERSION` and `RDF_MAKE_VERSION` to check for the library version. \ No newline at end of file +Use `RDF_INTERFACE_VERSION` and `RDF_MAKE_VERSION` to check for the library version. + +## Changelog + +Interface-level changes only: + +* **1.0**: Initial release +* **1.1**: Improve naming consistency: Add `rdfStreamFromUserStream`, mark `rdfStreamCreateFromUserStream` as deprecated + \ No newline at end of file diff --git a/imported/CMakeLists.txt b/imported/CMakeLists.txt index b708e5d..37d854b 100644 --- a/imported/CMakeLists.txt +++ b/imported/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### add_subdirectory(zstd) # This allows clients of RDF to have their own copy of catch2/cli11/json, and diff --git a/imported/catch2/CMakeLists.txt b/imported/catch2/CMakeLists.txt index fa25a4c..1787eb9 100644 --- a/imported/catch2/CMakeLists.txt +++ b/imported/catch2/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### project(Catch2) add_library(catch2 INTERFACE) target_include_directories(catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/imported/cli11/CMakeLists.txt b/imported/cli11/CMakeLists.txt index 7f2d03d..2c7ad2f 100644 --- a/imported/cli11/CMakeLists.txt +++ b/imported/cli11/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### project(CLI11 VERSION 1.9.1) add_library(cli11 INTERFACE) target_include_directories(cli11 INTERFACE ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/imported/json/CMakeLists.txt b/imported/json/CMakeLists.txt index e48fd59..cd6460b 100644 --- a/imported/json/CMakeLists.txt +++ b/imported/json/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### project(json VERSION 3.9.1) add_library(json INTERFACE) target_include_directories(json INTERFACE ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/imported/zstd/CMakeLists.txt b/imported/zstd/CMakeLists.txt index b721d84..825a284 100644 --- a/imported/zstd/CMakeLists.txt +++ b/imported/zstd/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### project(zstd VERSION 1.4.5) add_library(zstd STATIC src/zstd.c) target_include_directories(zstd PUBLIC ${CMAKE_CURRENT_LIST_DIR}/inc) diff --git a/rdf/CMakeLists.txt b/rdf/CMakeLists.txt index f622a07..08532ca 100644 --- a/rdf/CMakeLists.txt +++ b/rdf/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### if (RDF_STATIC) add_library(amdrdf STATIC) else() diff --git a/rdf/inc/amdrdf.h b/rdf/inc/amdrdf.h index 91f2549..85ddb2b 100644 --- a/rdf/inc/amdrdf.h +++ b/rdf/inc/amdrdf.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #pragma once #include @@ -24,7 +24,7 @@ ((static_cast(major) << 22) | \ (static_cast(minor) << 12)) -#define RDF_INTERFACE_VERSION RDF_MAKE_VERSION(1, 0) +#define RDF_INTERFACE_VERSION RDF_MAKE_VERSION(1, 1) extern "C" { struct rdfChunkFile; @@ -151,7 +151,18 @@ int RDF_EXPORT rdfStreamFromReadOnlyMemory(const std::int64_t size, const void* buffer, rdfStream** stream); int RDF_EXPORT rdfStreamCreateMemoryStream(rdfStream** stream); + +/** + * @deprecated Use `rdfStreamFromUserStream` instead + * + * This entry point will be removed in the next major version + */ int RDF_EXPORT rdfStreamCreateFromUserStream(const rdfUserStream* userStream, rdfStream** stream); + +/** + * @since 1.1 + */ +int RDF_EXPORT rdfStreamFromUserStream(const rdfUserStream* userStream, rdfStream** stream); int RDF_EXPORT rdfStreamClose(rdfStream** stream); int RDF_EXPORT rdfStreamRead(rdfStream*, @@ -325,6 +336,13 @@ class Stream final return result; } + static Stream FromUserStream(const rdfUserStream* userStream) + { + Stream result; + RDF_CHECK_CALL(rdfStreamFromUserStream(userStream, &result.stream_)); + return result; + } + ~Stream() { if (stream_) { diff --git a/rdf/src/amdrdf.cpp b/rdf/src/amdrdf.cpp index ca279d6..479321a 100644 --- a/rdf/src/amdrdf.cpp +++ b/rdf/src/amdrdf.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #include "amdrdf.h" #include @@ -1308,11 +1308,17 @@ int RDF_EXPORT rdfStreamCreateMemoryStream(rdfStream** handle) RDF_C_API_END } +////////////////////////////////////////////////////////////////////////////// +int RDF_EXPORT rdfStreamCreateFromUserStream(const rdfUserStream* userStream, rdfStream** handle) +{ + return rdfStreamFromUserStream(userStream, handle); +} + ////////////////////////////////////////////////////////////////////////////// /** Create a memory stream based on user provided callbacks. */ -int RDF_EXPORT rdfStreamCreateFromUserStream(const rdfUserStream* userStream, rdfStream** handle) +int RDF_EXPORT rdfStreamFromUserStream(const rdfUserStream* userStream, rdfStream** handle) { RDF_C_API_BEGIN diff --git a/rdf/test/CMakeLists.txt b/rdf/test/CMakeLists.txt index 00595dc..cf93ad4 100644 --- a/rdf/test/CMakeLists.txt +++ b/rdf/test/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### add_executable(rdf.Test) target_sources(rdf.Test PRIVATE inc/test_rdf.h diff --git a/rdf/test/src/IO_test.cpp b/rdf/test/src/IO_test.cpp index 5f3fd70..215a724 100644 --- a/rdf/test/src/IO_test.cpp +++ b/rdf/test/src/IO_test.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #include #include "amdrdf.h" diff --git a/rdf/test/src/main.cpp b/rdf/test/src/main.cpp index f91628d..957c98e 100644 --- a/rdf/test/src/main.cpp +++ b/rdf/test/src/main.cpp @@ -1,3 +1,3 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #define CATCH_CONFIG_MAIN #include diff --git a/rdfg/CMakeLists.txt b/rdfg/CMakeLists.txt index 710dc7a..4e66eee 100644 --- a/rdfg/CMakeLists.txt +++ b/rdfg/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### add_executable(rdfg) target_sources(rdfg PRIVATE src/rdfg.cpp) diff --git a/rdfg/src/rdfg.cpp b/rdfg/src/rdfg.cpp index 53512d0..d353775 100644 --- a/rdfg/src/rdfg.cpp +++ b/rdfg/src/rdfg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #include #include diff --git a/rdfi/CMakeLists.txt b/rdfi/CMakeLists.txt index 9da95e5..c28554c 100644 --- a/rdfi/CMakeLists.txt +++ b/rdfi/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### add_executable(rdfi) target_sources(rdfi PRIVATE src/rdfi.cpp) diff --git a/rdfi/src/rdfi.cpp b/rdfi/src/rdfi.cpp index 7bb0d77..231a5ff 100644 --- a/rdfi/src/rdfi.cpp +++ b/rdfi/src/rdfi.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #include #include diff --git a/rdfm/CMakeLists.txt b/rdfm/CMakeLists.txt index a14b718..3648d0f 100644 --- a/rdfm/CMakeLists.txt +++ b/rdfm/CMakeLists.txt @@ -1,4 +1,4 @@ -### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ### +### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ### add_executable(rdfm) target_sources(rdfm PRIVATE src/rdfm.cpp) diff --git a/rdfm/src/rdfm.cpp b/rdfm/src/rdfm.cpp index 2ffeaca..bc524ba 100644 --- a/rdfm/src/rdfm.cpp +++ b/rdfm/src/rdfm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */ +/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */ #include #include