Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main to feature/flat_map #5189

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
99ef0d0
Don't use `__restrict__` for CUDA (#5097)
StephanTLavavej Nov 19, 2024
64d143d
Enforce `assign_range()` mandates for sequence containers (#5086)
muellerj2 Nov 19, 2024
1711bc3
Vectorize `basic_string::rfind` (the single character overload) (#5087)
AlexGuteniev Nov 19, 2024
fec1c8b
`<algorithm>`: Fix bogus pointer arithmetic with integer-class (#5091)
frederick-vs-ja Nov 19, 2024
9b8a09a
More specific assertion for unlocking mutex not owned by the current …
AlexGuteniev Nov 22, 2024
8ebb4d6
Internally remove workaround in `Dev09_056375_locale_cleanup` (#5103)
CaseyCarter Nov 22, 2024
5e0ddad
Move `system_clock` from `<__msvc_chrono.hpp>` to `<chrono>` (#5105)
cpplearner Nov 22, 2024
2cef491
Maybe Clang _does_ work with `ALTERNATENAME` (#5098)
CaseyCarter Dec 5, 2024
126f4eb
Vectorize `basic_string::find` (#5101)
AlexGuteniev Dec 5, 2024
059a1b0
Prefer US English for `system_category()` messages, fall back to syst…
StephanTLavavej Dec 5, 2024
b60bb78
Implement LWG-4169 `std::atomic<T>`'s default constructor should be c…
frederick-vs-ja Dec 5, 2024
d40e8c0
Implement LWG-4140 Useless default constructors for bit reference typ…
frederick-vs-ja Dec 5, 2024
0053a14
Fix false positives by `filesystem::equivalent` on file systems with …
muellerj2 Dec 5, 2024
a8fea5b
Implement LWG-4135 The helper lambda of `std::erase` for `list` shoul…
frederick-vs-ja Dec 5, 2024
abefd5e
Implement LWG-4014 LWG-3809 changes behavior of some existing `std::s…
frederick-vs-ja Dec 5, 2024
649a4f2
Implement LWG-3918 `std::uninitialized_move/_n` and guaranteed copy e…
frederick-vs-ja Dec 5, 2024
e0b8a11
Implement LWG-4084 `std::fixed` ignores `std::uppercase` (#5151)
frederick-vs-ja Dec 5, 2024
a4ae6c3
Implement LWG-4112 `has-arrow` should require `operator->()` to be `c…
frederick-vs-ja Dec 5, 2024
ac971a3
Implement LWG-4124 Cannot format `zoned_time` with resolution coarser…
frederick-vs-ja Dec 5, 2024
83be0b7
Avoid arithmetic overflow in the constructors of `weekday` (#5156)
frederick-vs-ja Dec 5, 2024
79137b6
`<valarray>`: Make `valarray` ADL-proof as required (#5157)
frederick-vs-ja Dec 5, 2024
e3e65be
`<regex>`: Always reject character ranges with set limits (#5158)
muellerj2 Dec 5, 2024
b932cf8
`<regex>`: Repair character class escapes outside character class def…
muellerj2 Dec 5, 2024
89ca073
Globally suppress C5278 (#5163)
CaseyCarter Dec 5, 2024
b85dd2c
Toolset update: VS 2022 17.13 Preview 2, F32as_v6 (#5186)
StephanTLavavej Dec 13, 2024
0119980
Stop using ctest (#5169)
CaseyCarter Dec 13, 2024
eaf7355
Improve `basic_string::find_first_of` and `basic_string::find_last_of…
AlexGuteniev Dec 13, 2024
2378c81
Update _MSVC_STL_UPDATE to December 2024 (#5162)
kumar80 Dec 13, 2024
1a31980
`<stack>`, `<queue>`: Add `std::forward` for `append_range` (#5168)
hewillk Dec 13, 2024
0372e78
`<xmemory>`: Tolerate bogus const-overloading in iterators passed to …
StephanTLavavej Dec 13, 2024
53432eb
`<ranges>`: Fix regression with `ranges::to` for ADL-only `begin`/`en…
frederick-vs-ja Dec 13, 2024
d4b57c7
`<ranges>`: Fix formatting ranges for ADL-only ranges (#5178)
hewillk Dec 13, 2024
56bd1fe
`STL.natvis`: Simplify visualization for `string_view` (#5176)
pps83 Dec 13, 2024
ae9d115
`STL.natvis`: Simplify visualization for `string` (#5177)
pps83 Dec 13, 2024
7643c27
Mark `expected`, `unexpected`, and ALL exception types as `[[nodiscar…
StephanTLavavej Dec 13, 2024
53a43ef
Merge branch 'main' into merge-flat_map
StephanTLavavej Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ set(VCLIBS_DEBUG_OPTIONS "$<$<COMPILE_LANGUAGE:CXX>:/Od>")
set(VCLIBS_RELEASE_OPTIONS "$<$<COMPILE_LANGUAGE:CXX>:/O2;/Os>")

if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()

Expand Down
66 changes: 21 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.13 Preview 1 or later.
1. Install Visual Studio 2022 17.13 Preview 2 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
Expand All @@ -160,7 +160,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.13 Preview 1 or later.
1. Install Visual Studio 2022 17.13 Preview 2 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
Expand Down Expand Up @@ -269,34 +269,33 @@ C:\Users\username\Desktop>dumpbin /DEPENDENTS .\example.exe | findstr msvcp
* Otherwise, use [LLVM's installer][] and choose to add LLVM to your `PATH` during installation.
4. Follow the instructions below.

## Running All The Tests
## Running The Tests

After configuring and building the project, running `ctest` from the build output directory will run all the tests.
CTest will only display the standard error output of tests that failed. In order to get more details from CTest's
`lit` invocations, run the tests with `ctest -V`.
Our tests are currently split across three test suites that are located at `tests\std`, `tests\tr1`, and
`llvm-project\libcxx\test\std`. The test runner `${PROJECT_BINARY_DIR}\tests\utils\stl-lit\stl-lit.py` accepts paths to
directories in the test suites and runs all tests located in the subtree rooted at those paths. This can mean executing
the entirety of a single test suite, running all tests under a category in `libcxx`, or running a single test in `std`
and `tr1`.

## Running A Subset Of The Tests

`${PROJECT_BINARY_DIR}\tests\utils\stl-lit\stl-lit.py` can be invoked on a subdirectory of a test suite and will execute
all the tests under that subdirectory. This can mean executing the entirety of a single test suite, running all tests
under a category in libcxx, or running a single test in `std` and `tr1`.
Some useful `stl-lit.py` options:
* `-v` (verbose) tells `stl-lit.py` to show us output from failed test cases.
* `-Dnotags=ASAN` disables the "extra ASan configs" that we typically run only in CI. This is useful to limit runtime
for full validation runs, but often omitted when running just a few test cases to enable the extra ASan coverage.

## Examples

These examples assume that your current directory is `C:\Dev\STL\out\x64`.

* This command will run all of the test suites with verbose output.
+ `ctest -V`
* This command will also run all of the test suites.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\llvm-project\libcxx\test ..\..\tests\std ..\..\tests\tr1`
* This command will run all of the std test suite.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\tests\std`
* This command will run all of the test suites:
+ `python tests\utils\stl-lit\stl-lit.py -Dnotags=ASAN ..\..\llvm-project\libcxx\test ..\..\tests\std ..\..\tests\tr1`
* This command will run only the std test suite.
+ `python tests\utils\stl-lit\stl-lit.py -Dnotags=ASAN ..\..\tests\std`
* If you want to run a subset of a test suite, you need to point it to the right place in the sources. The following
will run the single test found under VSO_0000000_any_calling_conventions.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\tests\std\tests\VSO_0000000_any_calling_conventions`
will run the single test found under `VSO_0000000_any_calling_conventions`.
+ `python tests\utils\stl-lit\stl-lit.py -Dnotags=ASAN ..\..\tests\std\tests\VSO_0000000_any_calling_conventions`
* You can invoke `stl-lit` with any arbitrary subdirectory of a test suite. In libcxx this allows you to have finer
control over what category of tests you would like to run. The following will run all the libcxx map tests.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\llvm-project\libcxx\test\std\containers\associative\map`
+ `python tests\utils\stl-lit\stl-lit.py -Dnotags=ASAN ..\..\llvm-project\libcxx\test\std\containers\associative\map`
* You can also use the `--filter` option to include tests whose names match a regular expression. The following
command will run tests with "atomic_wait" in their names in both the std and libcxx test suites.
+ `python tests\utils\stl-lit\stl-lit.py ..\..\llvm-project\libcxx\test ..\..\tests\std --filter=atomic_wait`
Expand All @@ -305,31 +304,8 @@ control over what category of tests you would like to run. The following will ru

## Interpreting The Results Of Tests

### CTest

When running the tests via CTest, all of the test suites are considered to be a single test. If any single test in a
test suite fails, CTest will simply report that the `stl` test failed.

Example:
```
0% tests passed, 1 tests failed out of 1

Total Test time (real) = 2441.55 sec

The following tests FAILED:
1 - stl (Failed)
```

The primary utility of CTest in this case is to conveniently invoke `stl-lit.py` with the correct set of arguments.

CTest will output everything that was sent to stderr for each of the failed test suites, which can be used to identify
which individual test within the test suite failed. It can sometimes be helpful to run CTest with the `-V` option in
order to see the stdout of the tests.

### stl-lit

When running the tests directly via the generated `stl-lit.py` script the result of each test will be printed. The
format of each result is `{Result Code}: {Test Suite Name} :: {Test Name}:{Configuration Number}`.
`stl-lit.py` prints the result of each test. The format of each result is
`{Result Code}: {Test Suite Name} :: {Test Name}:{Configuration Number}`.

Example:
```
Expand Down
4 changes: 2 additions & 2 deletions azure-devops/asan-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stages:
hostArch: x64
targetArch: x64
asanBuild: true
ctestOptions: '--tests-regex stlasan'
testTargets: STL-ASan-CI

- stage: Build_And_Test_x86
displayName: 'Build and Test x86'
Expand All @@ -41,6 +41,6 @@ stages:
hostArch: x86
targetArch: x86
asanBuild: true
ctestOptions: '--tests-regex stlasan'
testTargets: STL-ASan-CI

# no coverage for ARM and ARM64
6 changes: 3 additions & 3 deletions azure-devops/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ parameters:
- name: buildBenchmarks
type: boolean
default: false
- name: ctestOptions
- name: testTargets
type: string
default: '--exclude-regex stlasan'
default: 'STL-CI'
- name: numShards
type: number
default: 8
Expand Down Expand Up @@ -61,5 +61,5 @@ jobs:
parameters:
hostArch: ${{ parameters.hostArch }}
targetArch: ${{ parameters.targetArch }}
ctestOptions: ${{ parameters.ctestOptions }}
testTargets: ${{ parameters.testTargets }}
skipTesting: ${{ parameters.skipTesting }}
10 changes: 5 additions & 5 deletions azure-devops/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

variables:
- name: poolName
value: 'StlBuild-2024-11-12T1255-Pool'
value: 'StlBuild-2024-12-12T1002-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
readonly: true
- name: tmpDir
value: 'D:\Temp'
value: 'C:\stlTemp'
readonly: true
- name: buildOutputLocation
value: 'D:\build'
value: 'C:\stlBuild'
readonly: true
- name: benchmarkBuildOutputLocation
value: 'D:\benchmark'
value: 'C:\stlBenchmark'
readonly: true
- name: validationBuildOutputLocation
value: 'D:\validation'
value: 'C:\stlValidation'
readonly: true
- name: Codeql.SkipTaskAutoInjection
value: true
Expand Down
8 changes: 6 additions & 2 deletions azure-devops/create-1es-hosted-pool.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $ErrorActionPreference = 'Stop'
$CurrentDate = Get-Date

$Location = 'eastus2'
$VMSize = 'Standard_D32ads_v5'
$VMSize = 'Standard_F32as_v6'
$ProtoVMName = 'PROTOTYPE'
$ImagePublisher = 'MicrosoftWindowsServer'
$ImageOffer = 'WindowsServer'
Expand Down Expand Up @@ -141,6 +141,7 @@ Display-ProgressBar -Status 'Creating prototype VM'
$VM = New-AzVMConfig `
-VMName $ProtoVMName `
-VMSize $VMSize `
-DiskControllerType 'NVMe' `
-Priority 'Regular'

$VM = Set-AzVMOperatingSystem `
Expand Down Expand Up @@ -261,6 +262,9 @@ New-AzRoleAssignment `
Display-ProgressBar -Status 'Creating image definition'

$ImageDefinitionName = $ResourceGroupName + '-ImageDefinition'
$FeatureTrustedLaunch = @{ Name = 'SecurityType'; Value = 'TrustedLaunch'; }
$FeatureNVMe = @{ Name = 'DiskControllerTypes'; Value = 'SCSI, NVMe'; }
$ImageDefinitionFeatures = @($FeatureTrustedLaunch, $FeatureNVMe)
New-AzGalleryImageDefinition `
-Location $Location `
-ResourceGroupName $ResourceGroupName `
Expand All @@ -271,7 +275,7 @@ New-AzGalleryImageDefinition `
-Publisher $ImagePublisher `
-Offer $ImageOffer `
-Sku $ImageSku `
-Feature @(@{ Name = 'SecurityType'; Value = 'TrustedLaunch'; }) `
-Feature $ImageDefinitionFeatures `
-HyperVGeneration 'V2' | Out-Null

####################################################################################################
Expand Down
4 changes: 2 additions & 2 deletions azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ foreach ($workload in $VisualStudioWorkloads) {
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.msi'
$PowerShellArgs = @('/quiet', '/norestart')

$PythonUrl = 'https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe'
$PythonUrl = 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-amd64.exe'
$PythonArgs = @('/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1', 'Include_doc=0')

$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe'
Expand Down Expand Up @@ -75,7 +75,7 @@ Function DownloadAndInstall {

try {
Write-Host "Downloading $Name..."
$tempPath = 'D:\installerTemp'
$tempPath = 'C:\installerTemp'
mkdir $tempPath -Force | Out-Null
$fileName = [uri]::new($Url).Segments[-1]
$installerPath = Join-Path $tempPath $fileName
Expand Down
4 changes: 2 additions & 2 deletions azure-devops/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ parameters:
type: string
- name: targetArch
type: string
- name: ctestOptions
- name: testTargets
type: string
- name: skipTesting
type: boolean
steps:
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
ctest --verbose ${{ parameters.ctestOptions }}
ninja --verbose -k 0 ${{ parameters.testTargets }}
displayName: 'Build and Run Tests'
timeoutInMinutes: 30
condition: and(succeeded(), not(${{ parameters.skipTesting }}))
Expand Down
52 changes: 40 additions & 12 deletions benchmarks/src/find_and_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,38 @@
#include <cstdint>
#include <cstdlib>
#include <ranges>
#include <string>
#include <type_traits>
#include <vector>

#include "skewed_allocator.hpp"

enum class Op {
FindSized,
FindUnsized,
Count,
StringFind,
StringRFind,
};

using namespace std;

template <class T, Op Operation>
template <class T, template <class> class Alloc, Op Operation>
void bm(benchmark::State& state) {
const auto size = static_cast<size_t>(state.range(0));
const auto pos = static_cast<size_t>(state.range(1));

vector<T> a(size, T{'0'});
using Container = conditional_t<Operation == Op::StringFind || Operation == Op::StringRFind,
basic_string<T, char_traits<T>, Alloc<T>>, vector<T, Alloc<T>>>;

Container a(size, T{'0'});

if (pos < size) {
a[pos] = T{'1'};
if constexpr (Operation == Op::StringRFind) {
a[size - pos - 1] = T{'1'};
} else {
a[pos] = T{'1'};
}
} else {
if constexpr (Operation == Op::FindUnsized) {
abort();
Expand All @@ -39,6 +52,10 @@ void bm(benchmark::State& state) {
benchmark::DoNotOptimize(ranges::find(a.begin(), unreachable_sentinel, T{'1'}));
} else if constexpr (Operation == Op::Count) {
benchmark::DoNotOptimize(ranges::count(a.begin(), a.end(), T{'1'}));
} else if constexpr (Operation == Op::StringFind) {
benchmark::DoNotOptimize(a.find(T{'1'}));
} else if constexpr (Operation == Op::StringRFind) {
benchmark::DoNotOptimize(a.rfind(T{'1'}));
}
}
}
Expand All @@ -50,17 +67,28 @@ void common_args(auto bm) {
}


BENCHMARK(bm<uint8_t, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint8_t, Op::FindUnsized>)->Apply(common_args);
BENCHMARK(bm<uint8_t, Op::Count>)->Apply(common_args);
BENCHMARK(bm<uint8_t, not_highly_aligned_allocator, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint8_t, highly_aligned_allocator, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint8_t, not_highly_aligned_allocator, Op::FindUnsized>)->Apply(common_args);
BENCHMARK(bm<uint8_t, highly_aligned_allocator, Op::FindUnsized>)->Apply(common_args);
BENCHMARK(bm<uint8_t, not_highly_aligned_allocator, Op::Count>)->Apply(common_args);
BENCHMARK(bm<uint8_t, highly_aligned_allocator, Op::Count>)->Apply(common_args);
BENCHMARK(bm<char, not_highly_aligned_allocator, Op::StringFind>)->Apply(common_args);
BENCHMARK(bm<char, highly_aligned_allocator, Op::StringFind>)->Apply(common_args);
BENCHMARK(bm<char, not_highly_aligned_allocator, Op::StringRFind>)->Apply(common_args);
BENCHMARK(bm<char, highly_aligned_allocator, Op::StringRFind>)->Apply(common_args);

BENCHMARK(bm<uint16_t, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint16_t, Op::Count>)->Apply(common_args);
BENCHMARK(bm<uint16_t, not_highly_aligned_allocator, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint16_t, not_highly_aligned_allocator, Op::Count>)->Apply(common_args);
BENCHMARK(bm<wchar_t, not_highly_aligned_allocator, Op::StringFind>)->Apply(common_args);
BENCHMARK(bm<wchar_t, not_highly_aligned_allocator, Op::StringRFind>)->Apply(common_args);

BENCHMARK(bm<uint32_t, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint32_t, Op::Count>)->Apply(common_args);
BENCHMARK(bm<uint32_t, not_highly_aligned_allocator, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint32_t, not_highly_aligned_allocator, Op::Count>)->Apply(common_args);
BENCHMARK(bm<char32_t, not_highly_aligned_allocator, Op::StringFind>)->Apply(common_args);
BENCHMARK(bm<char32_t, not_highly_aligned_allocator, Op::StringRFind>)->Apply(common_args);

BENCHMARK(bm<uint64_t, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint64_t, Op::Count>)->Apply(common_args);
BENCHMARK(bm<uint64_t, not_highly_aligned_allocator, Op::FindSized>)->Apply(common_args);
BENCHMARK(bm<uint64_t, not_highly_aligned_allocator, Op::Count>)->Apply(common_args);

BENCHMARK_MAIN();
10 changes: 7 additions & 3 deletions benchmarks/src/find_first_of.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <type_traits>
#include <vector>

#include "skewed_allocator.hpp"

using namespace std;

enum class AlgType { std_func, str_member_first, str_member_last };
Expand All @@ -24,7 +26,8 @@ void bm(benchmark::State& state) {
const size_t HSize = Pos * 2;
const size_t Which = 0;

using container = conditional_t<Alg == AlgType::std_func, vector<T>, basic_string<T>>;
using container = conditional_t<Alg == AlgType::std_func, vector<T, not_highly_aligned_allocator<T>>,
basic_string<T, char_traits<T>, not_highly_aligned_allocator<T>>>;

constexpr T HaystackFiller{' '};
static_assert(HaystackFiller < Start, "The following iota() should not produce the haystack filler.");
Expand Down Expand Up @@ -59,8 +62,9 @@ void bm(benchmark::State& state) {
}

void common_args(auto bm) {
bm->Args({2, 3})->Args({7, 4})->Args({9, 3})->Args({22, 5})->Args({58, 2})->Args({102, 4});
bm->Args({325, 1})->Args({400, 50})->Args({1011, 11})->Args({1502, 23})->Args({3056, 7});
bm->Args({2, 3})->Args({6, 81})->Args({7, 4})->Args({9, 3})->Args({22, 5})->Args({58, 2});
bm->Args({75, 85})->Args({102, 4})->Args({200, 46})->Args({325, 1})->Args({400, 50});
bm->Args({1011, 11})->Args({1280, 46})->Args({1502, 23})->Args({2203, 54})->Args({3056, 7});
}

BENCHMARK(bm<AlgType::std_func, uint8_t>)->Apply(common_args);
Expand Down
Loading