Skip to content

Commit

Permalink
Replace ahash with foldhash (#2615)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 authored Dec 12, 2024
1 parent 0c23367 commit 4aa7238
Show file tree
Hide file tree
Showing 38 changed files with 50 additions and 44 deletions.
14 changes: 10 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ version = "0.34"
path = "vulkano-util"

[workspace.dependencies]
ahash = "0.8"
# When updating Ash, also update vk.xml to the same Vulkan patch version that Ash uses.
# All versions of vk.xml can be found at:
# https://github.com/KhronosGroup/Vulkan-Headers/commits/main/registry/vk.xml
ash = "0.38.0"
bytemuck = "1.9"
concurrent-slotmap = "0.1.0-alpha.1"
crossbeam-queue = "0.3"
foldhash = "0.1"
half = "2.0"
heck = "0.4"
indexmap = "2.0"
Expand Down
2 changes: 1 addition & 1 deletion vulkano-shaders/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ categories = { workspace = true }
proc-macro = true

[dependencies]
ahash = { workspace = true }
foldhash = { workspace = true }
heck = { workspace = true }
proc-macro2 = { workspace = true }
quote = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion vulkano-shaders/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
#![recursion_limit = "1024"]

use crate::codegen::ShaderKind;
use ahash::HashMap;
use foldhash::HashMap;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use shaderc::{EnvVersion, SpirvVersion};
Expand Down
2 changes: 1 addition & 1 deletion vulkano-shaders/src/structs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{bail, codegen::Shader, LinAlgType, MacroInput};
use ahash::HashMap;
use foldhash::HashMap;
use proc_macro2::{Span, TokenStream};
use quote::{format_ident, quote, ToTokens, TokenStreamExt};
use std::{cmp::Ordering, num::NonZeroUsize};
Expand Down
2 changes: 1 addition & 1 deletion vulkano-taskgraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ keywords = { workspace = true }
categories = { workspace = true }

[dependencies]
ahash = { workspace = true }
ash = { workspace = true }
concurrent-slotmap = { workspace = true }
foldhash = { workspace = true }
parking_lot = { workspace = true }
smallvec = { workspace = true }
thread_local = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion vulkano-taskgraph/src/graph/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ mod tests {
struct MatchingState {
submission_index: usize,
instruction_index: usize,
semaphores: ahash::HashMap<&'static str, SemaphoreIndex>,
semaphores: foldhash::HashMap<&'static str, SemaphoreIndex>,
}

macro_rules! assert_matches_instructions {
Expand Down
2 changes: 1 addition & 1 deletion vulkano-taskgraph/src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use crate::{
resource::{self, AccessType, Flight, HostAccessType, ImageLayoutType},
Id, InvalidSlotError, Object, ObjectType, QueueFamilyType, Task,
};
use ahash::HashMap;
use ash::vk;
use concurrent_slotmap::{IterMut, IterUnprotected, SlotId, SlotMap};
use foldhash::HashMap;
use smallvec::SmallVec;
use std::{
borrow::Cow, cell::RefCell, error::Error, fmt, hint, iter::FusedIterator, ops::Range, sync::Arc,
Expand Down
2 changes: 1 addition & 1 deletion vulkano-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = { workspace = true }
categories = { workspace = true }

[dependencies]
ahash = { workspace = true }
foldhash = { workspace = true }
vulkano = { workspace = true }
winit = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion vulkano-util/src/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{context::VulkanoContext, window::WindowDescriptor};
use ahash::HashMap;
use foldhash::HashMap;
use std::{sync::Arc, time::Duration};
use vulkano::{
device::{Device, Queue},
Expand Down
2 changes: 1 addition & 1 deletion vulkano-util/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://github.com/bevyengine/bevy/blob/main/LICENSE-APACHE

use crate::{context::VulkanoContext, renderer::VulkanoWindowRenderer};
use ahash::HashMap;
use foldhash::HashMap;
use std::collections::hash_map::{Iter, IterMut};
use vulkano::swapchain::{PresentMode, SwapchainCreateInfo};
use winit::{
Expand Down
4 changes: 2 additions & 2 deletions vulkano/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ keywords = { workspace = true }
categories = { workspace = true }

[dependencies]
ahash = { workspace = true }
ash = { workspace = true }
bytemuck = { workspace = true, features = ["min_const_generics"] }
crossbeam-queue = { workspace = true }
foldhash = { workspace = true }
half = { workspace = true, features = ["bytemuck"] }
libloading = { workspace = true }
once_cell = { workspace = true }
Expand All @@ -38,7 +38,7 @@ x11-dl = { workspace = true, optional = true }
x11rb = { workspace = true, features = ["allow-unsafe-code"], optional = true }

[build-dependencies]
ahash = { workspace = true }
foldhash = { workspace = true }
heck = { workspace = true }
indexmap = { workspace = true }
nom = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion vulkano/autogen/features.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{write_file, IndexMap, VkRegistryData};
use ahash::HashMap;
use foldhash::HashMap;
use heck::ToSnakeCase;
use nom::{bytes::complete::tag, character::complete::digit1, combinator::eof, sequence::tuple};
use proc_macro2::{Ident, TokenStream};
Expand Down
4 changes: 2 additions & 2 deletions vulkano/autogen/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use self::spirv_grammar::SpirvGrammar;
use ahash::HashMap;
use foldhash::HashMap;
use nom::{
bytes::complete::{tag, take_until},
character::complete::{self, multispace0, multispace1},
Expand Down Expand Up @@ -34,7 +34,7 @@ mod spirv_parse;
mod spirv_reqs;
mod version;

pub type IndexMap<K, V> = indexmap::IndexMap<K, V, ahash::RandomState>;
pub type IndexMap<K, V> = indexmap::IndexMap<K, V, foldhash::fast::RandomState>;

pub fn autogen() {
let registry = get_vk_registry("vk.xml");
Expand Down
2 changes: 1 addition & 1 deletion vulkano/autogen/properties.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{write_file, IndexMap, VkRegistryData};
use ahash::{HashMap, HashSet};
use foldhash::{HashMap, HashSet};
use heck::ToSnakeCase;
use nom::{
bytes::complete::{tag, take_until, take_while1},
Expand Down
2 changes: 1 addition & 1 deletion vulkano/autogen/spirv_parse.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{write_file, SpirvGrammar};
use ahash::{HashMap, HashSet};
use foldhash::{HashMap, HashSet};
use heck::ToSnakeCase;
use once_cell::sync::Lazy;
use proc_macro2::{Ident, TokenStream};
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ahash::HashMap;
use foldhash::HashMap;
use parking_lot::RwLock;
use std::{
collections::hash_map::Entry,
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/command_buffer/auto/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use crate::{
},
DeviceSize, Validated, ValidationError, VulkanError,
};
use ahash::HashMap;
use foldhash::HashMap;
use parking_lot::{Mutex, RwLockReadGuard};
use smallvec::SmallVec;
use std::{
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/command_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ use crate::{
device::{DeviceFeatures, DeviceProperties},
pipeline::graphics::vertex_input::VertexInputRate,
};
use ahash::HashMap;
use bytemuck::{Pod, Zeroable};
use foldhash::HashMap;
use smallvec::SmallVec;
use std::{ops::Range, sync::Arc};

Expand Down
4 changes: 2 additions & 2 deletions vulkano/src/descriptor_set/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
Requires, RequiresAllOf, RequiresOneOf, Validated, ValidationError, Version, VulkanError,
VulkanObject,
};
use ahash::HashMap;
use foldhash::HashMap;
use smallvec::SmallVec;
use std::{collections::BTreeMap, mem::MaybeUninit, num::NonZeroU64, ptr, sync::Arc};

Expand Down Expand Up @@ -1396,7 +1396,7 @@ mod tests {
},
shader::ShaderStages,
};
use ahash::HashMap;
use foldhash::HashMap;

#[test]
fn empty() {
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/descriptor_set/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ use crate::{
image::{sampler::Sampler, ImageLayout},
Validated, ValidationError, VulkanError, VulkanObject,
};
use ahash::HashMap;
use foldhash::HashMap;
use parking_lot::{RwLock, RwLockReadGuard};
use smallvec::{smallvec, SmallVec};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/descriptor_set/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
Requires, RequiresAllOf, RequiresOneOf, Validated, ValidationError, Version, VulkanError,
VulkanObject,
};
use ahash::HashMap;
use foldhash::HashMap;
use smallvec::SmallVec;
use std::{cell::Cell, marker::PhantomData, mem::MaybeUninit, num::NonZeroU64, ptr, sync::Arc};

Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
shader::{spirv::ExecutionModel, DescriptorBindingRequirements},
Validated, ValidationError, VulkanError, VulkanObject,
};
use ahash::HashMap;
use foldhash::HashMap;
use std::{fmt::Debug, mem::MaybeUninit, num::NonZeroU64, ptr, sync::Arc};

/// A pipeline object that describes to the Vulkan implementation how it should perform compute
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/graphics/color_blend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
pipeline::inout_interface::{ShaderInterfaceLocationInfo, ShaderInterfaceLocationWidth},
Requires, RequiresAllOf, RequiresOneOf, ValidationError,
};
use ahash::HashMap;
use foldhash::HashMap;
use smallvec::SmallVec;
use std::iter;

Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/graphics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ use crate::{
},
Requires, RequiresAllOf, RequiresOneOf, Validated, ValidationError, VulkanError, VulkanObject,
};
use ahash::{HashMap, HashSet};
use foldhash::{HashMap, HashSet};
use fragment_shading_rate::FragmentShadingRateState;
use smallvec::SmallVec;
use std::{
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/graphics/vertex_input/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
},
ValidationError,
};
use ahash::HashMap;
use foldhash::HashMap;
use std::{borrow::Cow, collections::hash_map::Entry};

/// Trait for types that can create a [`VertexInputState`] from an [`EntryPoint`].
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/graphics/vertex_input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ use crate::{
pipeline::inout_interface::{ShaderInterfaceLocationInfo, ShaderInterfaceLocationWidth},
DeviceSize, Requires, RequiresAllOf, RequiresOneOf, ValidationError,
};
use ahash::HashMap;
use foldhash::HashMap;
use smallvec::SmallVec;

mod buffers;
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use crate::{
shader::{DescriptorBindingRequirements, ShaderStage, ShaderStages},
Validated, ValidationError, VulkanError, VulkanObject,
};
use ahash::HashMap;
use foldhash::HashMap;
use smallvec::SmallVec;
use std::{
array,
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
macros::{vulkan_bitflags, vulkan_enum},
shader::DescriptorBindingRequirements,
};
use ahash::HashMap;
use foldhash::HashMap;
use std::sync::Arc;

pub mod cache;
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/shader/inout_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
},
ValidationError,
};
use ahash::HashMap;
use foldhash::HashMap;
use std::{collections::hash_map::Entry, convert::Infallible};

pub(crate) fn validate_interfaces_compatible(
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/pipeline/shader/validate_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
},
DeviceSize, Requires, RequiresAllOf, RequiresOneOf, ValidationError, Version,
};
use ahash::HashMap;
use foldhash::HashMap;
use std::{cmp::max, convert::Infallible};

pub(crate) fn validate_runtime(
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/render_pass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{
Requires, RequiresAllOf, RequiresOneOf, Validated, ValidationError, Version, VulkanError,
VulkanObject,
};
use ahash::HashMap;
use foldhash::HashMap;
use smallvec::SmallVec;
use std::{
cmp::max,
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/shader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ use crate::{
Requires, RequiresAllOf, RequiresOneOf, Validated, ValidationError, Version, VulkanError,
VulkanObject,
};
use ahash::{HashMap, HashSet};
use bytemuck::bytes_of;
use foldhash::{HashMap, HashSet};
use half::f16;
use smallvec::SmallVec;
use spirv::ExecutionModel;
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/shader/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
},
DeviceSize, Version,
};
use ahash::{HashMap, HashSet};
use foldhash::{HashMap, HashSet};
use half::f16;
use smallvec::{smallvec, SmallVec};

Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/shader/spirv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! [SPIR-V specification](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html).
use crate::{shader::SpecializationConstant, Version};
use ahash::{HashMap, HashSet};
use foldhash::{HashMap, HashSet};
use smallvec::{smallvec, SmallVec};
use std::{
borrow::Cow,
Expand Down
2 changes: 1 addition & 1 deletion vulkano/src/shader/spirv/specialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::shader::{
spirv::{Decoration, Id, IdInfo, Instruction, SpecConstantInstruction},
SpecializationConstant,
};
use ahash::HashMap;
use foldhash::HashMap;
use half::f16;
use smallvec::{smallvec, SmallVec};

Expand Down
Loading

0 comments on commit 4aa7238

Please sign in to comment.